aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjw2552018-04-15 18:03:01 +0100
committerjw2552018-04-15 18:03:01 +0100
commitc8998c292d48e833f66cb43ea2c945f1a865a10e (patch)
tree42097422714d156396b27b67b4cb5a0426867886
parentfixed logging (diff)
downloadmedicine-c8998c292d48e833f66cb43ea2c945f1a865a10e.tar.gz
medicine-c8998c292d48e833f66cb43ea2c945f1a865a10e.zip

fixed fetching current_user

-rw-r--r--src/app.ts2
-rw-r--r--src/db/model/User.ts10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/app.ts b/src/app.ts
index e9d1d68..4dfeeda 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -77,7 +77,7 @@ class App {
.unless({path: [
'/',
'/cs3099group-be-4/oauth/token',
- '/cs3099group-be-4/_supported_protocols_'
+ '/cs3099group-be-4/_supported_protocols_'
] })
);
this.express.use(passport.initialize());
diff --git a/src/db/model/User.ts b/src/db/model/User.ts
index 171e899..3a0ef26 100644
--- a/src/db/model/User.ts
+++ b/src/db/model/User.ts
@@ -126,18 +126,20 @@ export default class User extends Model<User> {
}
public get fullInfo(): UserFullInfo {
+ console.log("fullinfo called")
// FIXME: Fetch these things if they aren't already present
if (this.userGroups === undefined) {
- throw new Error('userGroups undefined');
+ this.userGroups = [];
} else if (this.projects === undefined) {
- throw new Error('projects undefined');
+ this.projects = [];
}
+ console.log("2")
return {
username : this.username,
- privileges: this.userGroups
+ privileges: this.userGroups!
.filter((ug: UserGroup): boolean => ug.name !== null)
.map((ug: UserGroup): string => ug.name as string),
- projects : this.projects.map(
+ projects : this.projects!.map(
(p: Project): ProjectInfo => this.getProjectInfo(p)
),
// TODO: Check if we have anything to use these for yet?