diff options
| author | josh97josh | 2018-04-18 15:53:30 +0100 |
|---|---|---|
| committer | josh97josh | 2018-04-18 15:53:30 +0100 |
| commit | c2f1e602e9f1e4483af0c8c2224a907475d2eb07 (patch) | |
| tree | 112663132d35d0ed3e3d5c4e50e36f23b70c7f5f /src/index.ts | |
| parent | minor errors fixed (diff) | |
| download | medicine-c2f1e602e9f1e4483af0c8c2224a907475d2eb07.tar.gz medicine-c2f1e602e9f1e4483af0c8c2224a907475d2eb07.zip | |
User privileges added on post
Diffstat (limited to 'src/index.ts')
| -rw-r--r-- | src/index.ts | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/index.ts b/src/index.ts index 7e21c35..0b2cec9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ import { default as seq } from './db/orm'; import { default as User } from './db/model/User'; import { default as UserGroup } from './db/model/UserGroup'; +import { default as ContributorGroup } from './db/model/ContributorGroup'; const DEFAULT_PORT: number = 3000; @@ -59,8 +60,78 @@ logger.info(`Port ${port} chosen`); description: 'Allows Post to Log' }); + const userManagement: UserGroup = new UserGroup({ + name: 'userManagement', + canCreateUsers: true, + canDeleteUsers: true, + canEditUsers: true, + isInternal: false, + description: 'Allows management of other users' + }); + + const projectAdmin: UserGroup = new UserGroup({ + name: 'projectAdmin', + canDeleteProjects: true, + canEditProjects: true, + isInternal: false, + description: "Admin privileges on other projects " + }) + + const standardUser: UserGroup = new UserGroup({ + name: 'standardUser', + canCreateProjects: true, + isInternal: true, + description: "Allows creation of new projects" + }) + await logging.save(); await admin.save(); + await userManagement.save(); + await projectAdmin.save(); + await standardUser.save(); + + const projectOwner: ContributorGroup = new ContributorGroup({ + name: 'projectOwner', + canCreateFiles: true, + canAddUsers: true, + canRemoveUsers: true, + canDeleteFiles: true, + canDeleteProject: true, + canEditUserPermissions: true, + canViewFiles: true, + isInternal: false, + description: "Project Admin" + }); + + const standardProjectUser: ContributorGroup = new ContributorGroup({ + name: 'standardProjectUser', + canCreateFiles: true, + canViewFiles: true, + isInternal: false, + description: "Allows working on a project" + }); + + const readOnlyProjectUser: ContributorGroup = new ContributorGroup({ + name: 'readOnlyProjectUser', + canViewFiles: true, + isInternal: false, + description: "Allows viewing of files in a project " + }) + + const projectUserManagement: ContributorGroup = new ContributorGroup({ + name: 'projectUserManagement', + canAddUsers: true, + canEditUserPermissions: true, + canRemoveUsers: true, + isInternal: false, + description: "Allows managament of users in a Project" + }) + + await projectOwner.save(); + await standardProjectUser.save(); + await readOnlyProjectUser.save() + await projectUserManagement.save() + logger.info('Adding admin user'); |
