|
|
@ -1,6 +1,7 @@ |
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
AppEvents, |
|
|
|
AppEvents, |
|
|
|
|
|
|
|
extractRolesObj, |
|
|
|
OrgUserRoles, |
|
|
|
OrgUserRoles, |
|
|
|
PluginCategory, |
|
|
|
PluginCategory, |
|
|
|
ProjectRoles, |
|
|
|
ProjectRoles, |
|
|
@ -53,6 +54,26 @@ export class ProjectUsersService { |
|
|
|
param.projectUser, |
|
|
|
param.projectUser, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
getProjectRolePower({ |
|
|
|
|
|
|
|
project_roles: extractRolesObj(param.projectUser.roles), |
|
|
|
|
|
|
|
}) > getProjectRolePower(param.req.user) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
NcError.badRequest(`Insufficient privilege to invite with this role`); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
![ |
|
|
|
|
|
|
|
ProjectRoles.CREATOR, |
|
|
|
|
|
|
|
ProjectRoles.EDITOR, |
|
|
|
|
|
|
|
ProjectRoles.COMMENTER, |
|
|
|
|
|
|
|
ProjectRoles.VIEWER, |
|
|
|
|
|
|
|
ProjectRoles.NO_ACCESS, |
|
|
|
|
|
|
|
].includes(param.projectUser.roles as ProjectRoles) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
NcError.badRequest('Invalid role'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const emails = (param.projectUser.email || '') |
|
|
|
const emails = (param.projectUser.email || '') |
|
|
|
.toLowerCase() |
|
|
|
.toLowerCase() |
|
|
|
.split(/\s*,\s*/) |
|
|
|
.split(/\s*,\s*/) |
|
|
|