mirror of
https://github.com/plankanban/planka.git
synced 2025-07-18 20:59:44 +02:00
Project managers, board members, auto-update after reconnection, refactoring
This commit is contained in:
parent
7956503a46
commit
fe91b5241e
478 changed files with 21226 additions and 19495 deletions
|
@ -19,33 +19,27 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
|
||||
async fn(inputs, exits) {
|
||||
async fn(inputs) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
const labelToProjectPath = await sails.helpers
|
||||
.getLabelToProjectPath(inputs.id)
|
||||
let { label } = await sails.helpers.labels
|
||||
.getProjectPath(inputs.id)
|
||||
.intercept('pathNotFound', () => Errors.LABEL_NOT_FOUND);
|
||||
|
||||
let { label } = labelToProjectPath;
|
||||
const { project } = labelToProjectPath;
|
||||
const isBoardMember = await sails.helpers.users.isBoardMember(currentUser.id, label.boardId);
|
||||
|
||||
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
|
||||
project.id,
|
||||
currentUser.id,
|
||||
);
|
||||
|
||||
if (!isUserMemberForProject) {
|
||||
if (!isBoardMember) {
|
||||
throw Errors.LABEL_NOT_FOUND; // Forbidden
|
||||
}
|
||||
|
||||
label = await sails.helpers.deleteLabel(label, this.req);
|
||||
label = await sails.helpers.labels.deleteOne(label, this.req);
|
||||
|
||||
if (!label) {
|
||||
throw Errors.LABEL_NOT_FOUND;
|
||||
}
|
||||
|
||||
return exits.success({
|
||||
return {
|
||||
item: label,
|
||||
});
|
||||
};
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue