aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
authorjw2552018-04-22 17:38:20 +0100
committerjw2552018-04-22 17:38:20 +0100
commite7d3f35c1dfca06f3b60551673099c36dddde6ca (patch)
treedd1b386fc738e0041fcac83e56a378047edbace9 /src/index.ts
parentfixing tests (diff)
parentMerge branch 'trh/gets' of ssh://localhost:2222/cs3099group-be-4/project-code... (diff)
downloadmedicine-e7d3f35c1dfca06f3b60551673099c36dddde6ca.tar.gz
medicine-e7d3f35c1dfca06f3b60551673099c36dddde6ca.zip

Merge branch ‘trh/gets’ of https://gitlab.cs.st-andrews.ac.uk/cs3099group-be-4/project-code into trh/gets

Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/index.ts b/src/index.ts
index 5e35014..64a3cdc 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -16,6 +16,7 @@ import { default as seq } from './db/orm';
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;
@@ -63,8 +64,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');
const root: User = new User({