aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts76
1 files changed, 75 insertions, 1 deletions
diff --git a/src/index.ts b/src/index.ts
index d5708d7..ffb6f68 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,7 +1,10 @@
-
+import * as fs from 'fs-extra';
import { logger } from './logger';
logger.info('Starting up server');
+logger.info('Creating necessary directories');
+fs.ensureDirSync('logs/general');
+fs.ensureDirSync('files');
logger.info('Importing server logic');
import { default as app } from './app';
@@ -10,6 +13,7 @@ logger.info('Importing database ORM');
import { createRootFolder, rootPathId } from './files';
import { default as seq } from './db/orm';
+import { default as ContributorGroup } from './db/model/ContributorGroup';
import { default as File } from './db/model/File';
import { default as User } from './db/model/User';
import { default as UserGroup } from './db/model/UserGroup';
@@ -60,8 +64,77 @@ 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({
@@ -95,6 +168,7 @@ async function reset(): Promise<void> {
// /await reset();
+
logger.info('Booting ExpressJS server');
app.listen(port, (err: Error) => {
if (err) {