mirror of
https://github.com/plankanban/planka.git
synced 2025-07-20 21:59:43 +02:00
feat: Ability to allow everyone to create projects (#787)
This commit is contained in:
parent
f0e9fe7904
commit
cc1e886a31
8 changed files with 30 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
|||
const Errors = {
|
||||
NOT_ENOUGH_RIGHTS: {
|
||||
notEnoughRights: 'Not enough rights',
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
inputs: {
|
||||
name: {
|
||||
|
@ -6,9 +12,19 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
|
||||
exits: {
|
||||
notEnoughRights: {
|
||||
responseType: 'forbidden',
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs) {
|
||||
const { currentUser } = this.req;
|
||||
|
||||
if (!currentUser.isAdmin && !sails.config.custom.allowAllToCreateProjects) {
|
||||
throw Errors.NOT_ENOUGH_RIGHTS;
|
||||
}
|
||||
|
||||
const values = _.pick(inputs, ['name']);
|
||||
|
||||
const { project, projectManager } = await sails.helpers.projects.createOne.with({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue