File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,16 @@ def role_name
121
121
cis2_info . role_name if cis2_enabled?
122
122
end
123
123
124
+ def role_description
125
+ role = ( can_prescribe_pgd? ? "Nurse" : "Administrator" )
126
+
127
+ if can_access_sensitive_records? || can_perform_local_admin_tasks?
128
+ "#{ role } (Superuser)"
129
+ else
130
+ role
131
+ end
132
+ end
133
+
124
134
def can_view?
125
135
cis2_enabled? ? cis2_info . can_view? : !fallback_role . nil?
126
136
end
Original file line number Diff line number Diff line change 23
23
< svg class ="app-header__account-icon " xmlns ="http://www.w3.org/2000/svg " width ="20 " height ="20 " viewBox ="0 0 16 16 " aria-hidden ="true " focusable ="false ">
24
24
< path fill ="currentColor " d ="M8 0c4.4 0 8 3.6 8 8s-3.6 8-8 8-8-3.6-8-8 3.6-8 8-8Zm0 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm-1.5 9h3a2.5 2.5 0 0 1 2.5 2.5V14a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1.5A2.5 2.5 0 0 1 6.5 10ZM8 9C6.368 9 5 7.684 5 6s1.316-3 3-3c1.632 0 3 1.316 3 3S9.632 9 8 9 "> </ path >
25
25
</ svg >
26
- <%= current_user . full_name %> <%= ( role_name = current_user . role_name ) ? " (#{ role_name } )" : "" %>
26
+ <%= current_user . full_name %> <%= ( role_description = current_user . role_description ) ? " (#{ role_description } )" : "" %>
27
27
</ span >
28
28
<% if Settings . cis2 . enabled %>
29
29
< span class ="app-header__account-item ">
Original file line number Diff line number Diff line change 53
53
end
54
54
end
55
55
56
+ describe "#role_description" do
57
+ subject { user . role_description }
58
+
59
+ context "when the user is an admin" do
60
+ let ( :user ) { build ( :admin ) }
61
+
62
+ it { should eq ( "Administrator" ) }
63
+ end
64
+
65
+ context "when the user is a nurse" do
66
+ let ( :user ) { build ( :nurse ) }
67
+
68
+ it { should eq ( "Nurse" ) }
69
+ end
70
+
71
+ context "when the user is a superuser" do
72
+ let ( :user ) { build ( :admin , :superuser ) }
73
+
74
+ it { should eq ( "Administrator (Superuser)" ) }
75
+ end
76
+ end
77
+
56
78
describe "#can_view?" do
57
79
subject { user . can_view? }
58
80
You can’t perform that action at this time.
0 commit comments