Skip to content

Commit 8498b46

Browse files
authored
Add reviewer role to workgroup (#1915)
* grant access to reviewer role * add reviewer role to workgroup tabs
1 parent dfa373e commit 8498b46

8 files changed

Lines changed: 28 additions & 17 deletions

File tree

app/registrarReconciliationReport/controllers/registrarReconciliationReportCtrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class registrarReconciliationReportCtrl {
5656
);
5757

5858
self.$scope.view.hasAccess = self.$scope.sharedState.currentUser.isAdmin() ||
59-
self.$scope.sharedState.currentUser.hasRole('academicPlanner', self.$scope.sharedState.workgroup.id);
59+
self.$scope.sharedState.currentUser.hasRole(['academicPlanner', 'reviewer'], self.$scope.sharedState.workgroup.id);
6060
});
6161

6262
this.$scope.allTerms = ['05', '06', '07', '08', '09', '10', '01', '02', '03'];

app/reports/reportsApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function config ($routeProvider) {
3939
validate: function (AuthService, $route, BudgetComparisonReportActions) {
4040
return AuthService.validate().then(function () {
4141
if ($route.current.params.workgroupId) {
42-
var hasAccess = AuthService.getCurrentUser().hasAccess('academicPlanner', $route.current.params.workgroupId);
42+
var hasAccess = AuthService.getCurrentUser().hasAccess(['academicPlanner', 'reviewer'], $route.current.params.workgroupId);
4343

4444
if (hasAccess) {
4545
return BudgetComparisonReportActions.getInitialState();

app/scheduleSummaryReport/scheduleSummaryReportApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function config ($routeProvider) {
4040
validate: function (AuthService, $route, ScheduleSummaryReportActionCreators) {
4141
return AuthService.validate().then(function () {
4242
if ($route.current.params.workgroupId) {
43-
var hasAccess = AuthService.getCurrentUser().hasAccess('academicPlanner', $route.current.params.workgroupId);
43+
var hasAccess = AuthService.getCurrentUser().hasAccess(['academicPlanner', 'reviewer'], $route.current.params.workgroupId);
4444

4545
if (hasAccess) {
4646
return ScheduleSummaryReportActionCreators.getInitialState();

app/shared/directives/nav/nav.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,43 +100,43 @@ <h1 style="color: #fff; margin:0;">IPA</h1>
100100

101101
<!-- add class "multiple-expanded" to allow multiple submenus to open -->
102102
<!-- class "auto-inherit-active-class" will automatically add "active" class for parent elements who are marked already with class "active" -->
103-
<li ng-class="{ 'active': currentBaseHref == 'courses' }" ng-if="userHasRoles(['academicPlanner','reviewer'])">
103+
<li ng-class="{ 'active': currentBaseHref == 'courses' }" ng-if="userHasRoles(['academicPlanner'])">
104104
<a ng-href="/courses/{{ workgroupId }}/{{ year }}">
105105
<i class="entypo-book"></i>
106106
<span class="title">Courses</span>
107107
</a>
108108
</li>
109109
<li ng-class="{ 'active': currentBaseHref == 'assignments' || currentBaseHref == 'teachingCalls', 'opened': expanded == 'assignments' || (!expanded && (currentBaseHref == 'assignments' || currentBaseHref == 'teachingCalls')) }"
110-
ng-if="userHasRoles(['academicPlanner','reviewer'])" class="has-sub root-level">
110+
ng-if="userHasRoles(['academicPlanner'])" class="has-sub root-level">
111111
<a class="clickable" ng-click="toggleMenuItem('assignments')">
112112
<i class="entypo-user-add"></i>
113113
<span class="title">Instructors</span>
114114
</a>
115115
<ul ng-class="{ 'visible': expanded == 'assignments' || (!expanded && (currentBaseHref == 'assignments' || currentBaseHref == 'teachingCalls')) }">
116116
<li ng-class="{ 'active': currentBaseHref == 'assignments' && currentEndHref != 'teachingCallStatus' }"
117-
ng-if="userHasRoles(['academicPlanner','reviewer'])">
117+
ng-if="userHasRoles(['academicPlanner'])">
118118
<a ng-href="/assignments/{{ workgroupId }}/{{ year }}">
119119
<span class="title">Assign Instructors</span>
120120
</a>
121121
</li>
122122
<li ng-class="{ 'active': currentBaseHref == 'teachingCalls' && currentEndHref == 'teachingCallStatus' }"
123-
ng-if="userHasRoles(['academicPlanner','reviewer'])">
123+
ng-if="userHasRoles(['academicPlanner'])">
124124
<a ng-href="/teachingCalls/{{ workgroupId }}/{{ year }}/teachingCallStatus">
125125
<span class="title">Teaching Calls</span>
126126
</a>
127127
</li>
128128
</ul>
129129
</li>
130130

131-
<li ng-class="{ 'active': currentBaseHref == 'scheduling' }" ng-if="userHasRoles(['academicPlanner','reviewer'])">
131+
<li ng-class="{ 'active': currentBaseHref == 'scheduling' }" ng-if="userHasRoles(['academicPlanner'])">
132132
<a ng-href="/scheduling/{{ workgroupId }}/{{ year }}/{{ termShortCode || '03'}}">
133133
<i class="entypo-calendar"></i>
134134
<span class="title">Schedule</span>
135135
</a>
136136
</li>
137137

138138
<li ng-class="{ 'active': currentBaseHref == 'supportCalls' || currentBaseHref == 'supportAssignments', 'opened': expanded == 'support' || (!expanded && (currentBaseHref == 'supportCalls' || currentBaseHref == 'supportAssignments')) }"
139-
ng-if="userHasRoles(['academicPlanner','reviewer'])" class="has-sub root-level">
139+
ng-if="userHasRoles(['academicPlanner', 'reviewer'])" class="has-sub root-level">
140140
<a class="clickable" ng-click="toggleMenuItem('support')">
141141
<i class="entypo-users"></i>
142142
<span class="title">TAs & Readers</span>
@@ -147,15 +147,15 @@ <h1 style="color: #fff; margin:0;">IPA</h1>
147147
Support Assignments
148148
</a>
149149
</li>
150-
<li ng-class="{ 'active': currentBaseHref == 'supportCalls' }">
150+
<li ng-class="{ 'active': currentBaseHref == 'supportCalls' }" ng-if="userHasRoles(['academicPlanner'])">
151151
<a ng-href="/supportCalls/{{ workgroupId }}/{{ year }}/{{ termShortCode || '03'}}">
152152
Support Calls
153153
</a>
154154
</li>
155155
</ul>
156156
</li>
157157

158-
<li ng-class="{ 'active': currentBaseHref == 'budget' }" ng-if="userHasRoles(['academicPlanner','reviewer'])">
158+
<li ng-class="{ 'active': currentBaseHref == 'budget' }" ng-if="userHasRoles(['academicPlanner'])">
159159
<a ng-href="/budget/{{ workgroupId }}/{{ year }}">
160160
<i class="entypo-chart-pie"></i>
161161
<span class="title">Budget</span>
@@ -171,7 +171,7 @@ <h1 style="color: #fff; margin:0;">IPA</h1>
171171
<span class="title">Reports</span>
172172
</a>
173173
<ul ng-class="{ 'visible': expanded == 'reports' || (!expanded && (currentBaseHref == 'registrarReconciliationReport' || currentBaseHref == 'scheduleSummaryReport' || currentBaseHref == 'teachingCallResponseReport' || currentBaseHref == 'workloadSummaryReport' || currentBaseHref == 'supportCallResponseReport' || currentBaseHref == 'reports') ) }">
174-
<li ng-class="{ 'active': currentBaseHref == 'registrarReconciliationReport' }">
174+
<li ng-class="{ 'active': currentBaseHref == 'registrarReconciliationReport' }" ng-if="userHasRoles(['academicPlanner'])">
175175
<a ng-href="/registrarReconciliationReport/{{ workgroupId }}/{{ year }}/{{ termShortCode || '03' }}">
176176
Registrar Reconciliation
177177
</a>
@@ -181,7 +181,7 @@ <h1 style="color: #fff; margin:0;">IPA</h1>
181181
Schedule Summary
182182
</a>
183183
</li>
184-
<li ng-class="{ 'active': currentBaseHref == 'teachingCallResponseReport' }">
184+
<li ng-class="{ 'active': currentBaseHref == 'teachingCallResponseReport' }" ng-if="userHasRoles(['academicPlanner'])">
185185
<a ng-href="/teachingCallResponseReport/{{ workgroupId }}/{{ year }}">
186186
Teaching Call Response
187187
</a>
@@ -191,7 +191,7 @@ <h1 style="color: #fff; margin:0;">IPA</h1>
191191
Workload Summary
192192
</a>
193193
</li>
194-
<li ng-class="{ 'active': currentBaseHref == 'supportCallResponseReport' }">
194+
<li ng-class="{ 'active': currentBaseHref == 'supportCallResponseReport' }" ng-if="userHasRoles(['academicPlanner'])">
195195
<a ng-href="/supportCallResponseReport/{{ workgroupId }}/{{ year }}/{{ termShortCode || '03' }}">
196196
Support Call Response
197197
</a>

app/supportAssignment/SupportAssignmentCtrl.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ class SupportAssignmentCtrl {
7474

7575
// Determine access level
7676
userRoles.forEach(function(userRole) {
77-
if ((userRole.roleName == "academicPlanner" && userRole.workgroupId == _self.$scope.workgroupId) || userRole.roleName == "admin") {
77+
if ((["academicPlanner", "reviewer"].includes(userRole.roleName) && userRole.workgroupId == _self.$scope.workgroupId) || userRole.roleName == "admin") {
7878
_self.$scope.isAllowed = true;
7979
_self.$scope.readOnlyMode = false;
8080
}
81+
82+
if (userRole.roleName == "reviewer") {
83+
_self.$scope.readOnlyMode = true;
84+
}
8185
});
8286

8387
// If access has not yet been set

app/supportAssignment/supportAssignmentApp.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ function config ($routeProvider) {
5555
} else {
5656
return AuthService.validate().then(function () {
5757
if ($route.current.params.workgroupId) {
58-
SupportActions.getInitialState();
58+
var hasAccess = AuthService.getCurrentUser().hasAccess(['academicPlanner', 'reviewer'], $route.current.params.workgroupId);
59+
60+
if (hasAccess) {
61+
return SupportActions.getInitialState();
62+
} else {
63+
return { noAccess: true };
64+
}
5965
}
6066
});
6167
}

app/workgroup/services/workgroupStateService.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ class WorkgroupStateService {
240240
"Academic Planner",
241241
"Instructor",
242242
"Student",
243+
"Reviewer",
243244
"Presence"],
244245
},
245246
instructorTypes: [],

app/workloadSummaryReport/workloadSummaryReportApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function config ($routeProvider) {
4040
return AuthService.validate().then(function () {
4141
if ($route.current.params.workgroupId) {
4242
if ($route.current.params.workgroupId) {
43-
var hasAccess = AuthService.getCurrentUser().hasAccess('academicPlanner', $route.current.params.workgroupId);
43+
var hasAccess = AuthService.getCurrentUser().hasAccess(['academicPlanner', 'reviewer'], $route.current.params.workgroupId);
4444

4545
if (hasAccess) {
4646
return WorkloadSummaryActions.getInitialState();

0 commit comments

Comments
 (0)