You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48-5Lines changed: 48 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,8 +57,19 @@ commtrackr.init({ // Initialize CommTracker with configurations
57
57
},
58
58
vars: {
59
59
userId:'username', // req.session object variable for unique user identification
60
-
userName:'name', // req.session object variable for user name
60
+
userName:'Name', // req.session object variable for user name
61
61
role:'role', // req.session object variable for user role
62
+
roleAliases: { // Use if your role names differ from 'admin', 'dev', or 'user'
63
+
user: ['user', 'standard', 'basic'], // Aliases for user roles
64
+
dev: ['dev', 'developer'], // Aliases for developer roles
65
+
admin: ['admin', 'administrator', 'superuser'] // Aliases for admin roles
66
+
},
67
+
access: { // Alternative access control using numeric levels
68
+
var:'access', // req.session object variable for access level
69
+
user: [0], // Access levels for standard users
70
+
dev: [1], // Access levels for developers
71
+
admin: [2] // Access levels for admins
72
+
},
62
73
commissions:'commissions', // req.session object variable for user commissions array
63
74
},
64
75
});
@@ -78,37 +89,69 @@ These variables must be set in your `req.session` object to enable CommTrackr fu
78
89
79
90
Type: `String`
80
91
92
+
Default: `'username'`
93
+
81
94
Fallback: None
82
95
83
-
Example: `'username'`
96
+
Session Example: `'id'`
84
97
85
98
### userName
86
99
87
100
`req.session.userName` should contain the name of the user. This is used for display purposes in the CommTrackr interface. Fallback to `userId` if not set.
88
101
89
102
Type: `String`
90
103
104
+
Default: `'name'`
105
+
91
106
Fallback: `req.session.userId`
92
107
93
-
Example: `'John Doe'`
108
+
Session Example: `'John Doe'`
94
109
95
110
### role
96
111
97
112
`req.session.role` should contain the role of the user: 'admin', `dev`, or 'user'. This is used to control access to certain features and functionalities within CommTrackr.
98
113
99
114
Type: `String`
100
115
116
+
Default: `'role'`
117
+
101
118
Fallback: `user`
102
119
103
-
Example: `'user'`, `'dev'`, `'admin'`
120
+
Session Example: `'user'`, `'dev'`, `'admin'`
121
+
122
+
### roleAliases
123
+
124
+
`req.session.role` can also be set to custom role names. Use `roleAliases` to map your custom role names to the standard roles used by CommTrackr.
125
+
126
+
Type: `Object`
127
+
128
+
Default:
129
+
130
+
```javascript
131
+
{}
132
+
```
133
+
134
+
### access
135
+
136
+
`req.session.access` can be used as an alternative to `role` for access control. It should contain numeric access levels. Use the `access` configuration to define which levels correspond to 'user', 'dev', and 'admin'.
137
+
138
+
Type: `Array`
139
+
140
+
Default:
141
+
142
+
```javascript
143
+
{}
144
+
```
104
145
105
146
### commissions
106
147
107
148
`req.session.commissions` should be an array of commission objects associated with the user. Each commission object should have the following structure:
0 commit comments