aboutsummaryrefslogtreecommitdiff
path: root/src/server/authentication/models/current_user_utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/authentication/models/current_user_utils.ts')
-rw-r--r--src/server/authentication/models/current_user_utils.ts27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/server/authentication/models/current_user_utils.ts b/src/server/authentication/models/current_user_utils.ts
index 3291c671c..055e4cc97 100644
--- a/src/server/authentication/models/current_user_utils.ts
+++ b/src/server/authentication/models/current_user_utils.ts
@@ -7,13 +7,15 @@ import { Document } from "../../../fields/Document";
import { KeyStore } from "../../../fields/KeyStore";
import { ListField } from "../../../fields/ListField";
import { Documents } from "../../../client/documents/Documents";
+import { Schema, Attribute, AttributeGroup } from "../../../client/northstar/model/idea/idea";
export class CurrentUserUtils {
private static curr_email: string;
private static curr_id: string;
private static user_document: Document;
- //TODO tfs: this should be temporary...
+ //TODO tfs: these should be temporary...
private static mainDocId: string | undefined;
+ private static activeSchema: Schema | undefined;
public static get email(): string {
return this.curr_email;
@@ -35,6 +37,29 @@ export class CurrentUserUtils {
this.mainDocId = id;
}
+ public static get ActiveSchema(): Schema | undefined {
+ return this.activeSchema;
+ }
+ public static GetAllNorthstarColumnAttributes() {
+ if (!this.ActiveSchema || !this.ActiveSchema.rootAttributeGroup) {
+ return [];
+ }
+ const recurs = (attrs: Attribute[], g: AttributeGroup) => {
+ if (g.attributes) {
+ attrs.push.apply(attrs, g.attributes);
+ if (g.attributeGroups) {
+ g.attributeGroups.forEach(ng => recurs(attrs, ng));
+ }
+ }
+ };
+ const allAttributes: Attribute[] = new Array<Attribute>();
+ recurs(allAttributes, this.ActiveSchema.rootAttributeGroup);
+ return allAttributes;
+ }
+
+ public static set ActiveSchema(id: Schema | undefined) {
+ this.activeSchema = id;
+ }
private static createUserDocument(id: string): Document {
let doc = new Document(id);