|
25 | 25 | import { Users } from '../../../both/collections/user.collection';
|
26 | 26 | import { addRoleForCourse } from '../../../server/methods/user.methods';
|
27 | 27 |
|
28 |
| - /* |
29 |
| - * cleanupDatabase |
30 |
| - * cleans up databases |
31 |
| - */ |
32 |
| - export function cleanupDatabase(){ |
33 |
| - CourseRecords.remove({}); |
34 |
| - Courses.remove({}); |
35 |
| - Labs.remove({}); |
36 |
| - Sessions.remove({}); |
37 |
| - Users.remove({}); |
38 |
| - } |
39 |
| - |
40 | 28 | /*
|
41 | 29 | * defaultFixtures
|
42 | 30 | */
|
|
59 | 47 |
|
60 | 48 | constructor(){
|
61 | 49 |
|
| 50 | + // Reset Database |
| 51 | + CourseRecords.remove({}); |
| 52 | + Courses.remove({}); |
| 53 | + Labs.remove({}); |
| 54 | + Sessions.remove({}); |
| 55 | + Users.remove({}); |
| 56 | + |
62 | 57 | // Users
|
63 | 58 | this.users = {
|
64 |
| - "global_admin": Users.insert({ |
65 |
| - username: "global_admin", |
66 |
| - profile: { |
67 |
| - name : "Derek Brown", |
68 |
| - organization : "Carnegie Mellon University", |
69 |
| - |
70 |
| - picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg" |
71 |
| - }, |
72 |
| - global_admin: true, |
73 |
| - roles: [] |
74 |
| - }, () => { |
75 |
| - Accounts.setPassword(this.users["global_admin"], "global_admin"); |
76 |
| - }), |
77 |
| - |
78 |
| - "course_admin": Users.insert({ |
79 |
| - username: "course_admin", |
80 |
| - profile: { |
81 |
| - name : "Aaron Mortenson", |
82 |
| - organization : "Carnegie Mellon University", |
83 |
| - |
84 |
| - picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg" |
85 |
| - }, |
86 |
| - global_admin: false, |
87 |
| - roles: [] |
88 |
| - }, () => { |
89 |
| - Accounts.setPassword(this.users["course_admin"], "course_admin"); |
90 |
| - }), |
91 |
| - |
92 |
| - "instructor": Users.insert({ |
93 |
| - username: "instructor", |
94 |
| - profile: { |
95 |
| - name : "Sander Shi", |
96 |
| - organization : "Carnegie Mellon University", |
97 |
| - |
98 |
| - picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg" |
99 |
| - }, |
100 |
| - global_admin: false, |
101 |
| - roles: [] |
102 |
| - }, () => { |
103 |
| - Accounts.setPassword(this.users["instructor"], "instructor"); |
104 |
| - }), |
105 |
| - |
106 |
| - "student": Users.insert({ |
107 |
| - username: "student", |
108 |
| - profile: { |
109 |
| - name : "Cem Ersoz", |
110 |
| - organization : "Carnegie Mellon University", |
111 |
| - |
112 |
| - picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg" |
113 |
| - }, |
114 |
| - global_admin: false, |
115 |
| - roles: [] |
116 |
| - }, () => { |
117 |
| - Accounts.setPassword(this.users["student"], "student"); |
118 |
| - }) |
119 |
| - }; |
| 59 | + global_admin : <string> Accounts.createUser({ |
| 60 | + username: "global_admin", |
| 61 | + |
| 62 | + password: "global_admin", |
| 63 | + profile: { |
| 64 | + name : "Global Admin", |
| 65 | + organization : "Carnegie Mellon University", |
| 66 | + picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg" |
| 67 | + } |
| 68 | + }), |
| 69 | + |
| 70 | + course_admin : <string> Accounts.createUser({ |
| 71 | + username: "course_admin", |
| 72 | + |
| 73 | + password: "course_admin", |
| 74 | + profile: { |
| 75 | + name : "Course Admin", |
| 76 | + organization : "Carnegie Mellon University", |
| 77 | + picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg" |
| 78 | + } |
| 79 | + }), |
| 80 | + |
| 81 | + instructor : <string> Accounts.createUser({ |
| 82 | + username: "instructor", |
| 83 | + |
| 84 | + password: "instructor", |
| 85 | + profile: { |
| 86 | + name : "Instructor", |
| 87 | + organization : "Carnegie Mellon University", |
| 88 | + picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg" |
| 89 | + } |
| 90 | + }), |
| 91 | + |
| 92 | + student : <string> Accounts.createUser({ |
| 93 | + username: "student", |
| 94 | + |
| 95 | + password: "student", |
| 96 | + profile: { |
| 97 | + name : "Student", |
| 98 | + organization : "Carnegie Mellon University", |
| 99 | + picture : "https://c2.staticflickr.com/4/3025/2414332460_bb710ed7b3.jpg" |
| 100 | + } |
| 101 | + }) |
| 102 | + } |
| 103 | + Users.setGlobalAdministrator(this.users.global_admin, true); |
120 | 104 |
|
121 | 105 | // Courses
|
122 | 106 | this.courses = ({
|
|
187 | 171 | addRoleForCourse(this.courses.gpi, this.users.instructor, Role.instructor);
|
188 | 172 |
|
189 | 173 | }
|
190 |
| - |
191 |
| - public destructor(){ |
192 |
| - |
193 |
| - // Delete Users |
194 |
| - _.forEach(this.users, function(value, key){ |
195 |
| - Users.remove({ '_id' : value }); |
196 |
| - }) |
197 |
| - |
198 |
| - // Delete Courses |
199 |
| - _.forEach(this.courses, function(value, key){ |
200 |
| - Courses.remove({ '_id' : value }); |
201 |
| - }) |
202 |
| - |
203 |
| - // Delete Labs |
204 |
| - _.forEach(this.labs, function(value, key){ |
205 |
| - Labs.remove({ '_id' : value }); |
206 |
| - }) |
207 |
| - } |
208 | 174 | }
|
0 commit comments