-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.js
66 lines (47 loc) · 1.59 KB
/
user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* User
*
* Models users that are working on the current project.
* Includes role in the project and light biographical information.
*
* The methods defined pertain to the manipulation of activity objects
*
*/
var User = function(first, last, username, role, imgLocation, permissions) {
this.firstName = first;
this.lastName = last;
//Check to see if database has username first, if not then set the given username
this.username = username;
this.role = role;
//We will load image files into Image objects here
userImage = new Image();
this.userImage.src = ""imgLocation"";
//Check to see if database has username first, if not then set the given username
this.username = username;
this.role = role;
//We will load image files into Image objects here
this.userImage = new Image();
this.userImage.src = ""imgLocation"";
//A string array of permissions will be set
this.permissions = permissions[];
//Each user will have a string array of the titles of their activities
this.activityLog = [];
}
User.prototype.getName = function(){
return this.first + " " + this.last;
}
User.prototype.updateRole = function(newRole){
this.role = newRole;
}
User.prototype.updateImg = function(newImgLocation){
this.imgLocation = newImgLocation;
}
User.prototype.addActivity() = function(item){
this.activityLog.push(item);
}
User.prototype.removeActivity() = function(item){
this.activityLog[this.getIndexOf(item)] = null;
}
User.prototype.updatePermissions() = function(permissions[i]){
this.permissions[i] = permissions[i];
}
}