1
0
Fork 0
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:
NathanVss 2024-06-14 16:38:06 +02:00 committed by GitHub
parent f0e9fe7904
commit cc1e886a31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 30 additions and 7 deletions

View file

@ -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({