diff options
| author | josh97josh | 2018-04-22 17:33:13 +0100 |
|---|---|---|
| committer | josh97josh | 2018-04-22 17:33:13 +0100 |
| commit | 68bd207cbf6e6d5bb1580841aa874c85e584752e (patch) | |
| tree | efb4c8699f86e8f23259410d6bfbd0aa95fc2cdc /src/index.ts | |
| parent | Merge branch 'trh/gets' of ssh://localhost:2222/cs3099group-be-4/project-code... (diff) | |
| parent | added check permissions functions (diff) | |
| download | medicine-68bd207cbf6e6d5bb1580841aa874c85e584752e.tar.gz medicine-68bd207cbf6e6d5bb1580841aa874c85e584752e.zip | |
Merge branch ‘jl247/permissions’ into trh/gets
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 1ce284d..b323895 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,6 +13,7 @@ import { View, files, views, rootPathId, createRootFolder } from './files'; import { default as File } from './db/model/File'; 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; @@ -60,8 +61,78 @@ async function reset(): Promise<void> { 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'); |
