File tree 3 files changed +17
-3
lines changed
3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ type alias Account a =
19
19
, pronouns : Maybe String
20
20
, completedTours : List Tour
21
21
, organizationMemberships : List OrganizationMembership
22
+ , isSuperAdmin : Bool
22
23
}
23
24
24
25
@@ -88,18 +89,20 @@ isProjectOwner projectRef account =
88
89
decodeSummary : Decode .Decoder AccountSummary
89
90
decodeSummary =
90
91
let
91
- makeSummary handle name_ avatarUrl completedTours organizationMemberships =
92
+ makeSummary handle name_ avatarUrl completedTours organizationMemberships isSuperAdmin =
92
93
{ handle = handle
93
94
, name = name_
94
95
, avatarUrl = avatarUrl
95
96
, pronouns = Nothing
96
97
, completedTours = Maybe . withDefault [] completedTours
97
98
, organizationMemberships = organizationMemberships
99
+ , isSuperAdmin = isSuperAdmin
98
100
}
99
101
in
100
- Decode . map5 makeSummary
102
+ Decode . map6 makeSummary
101
103
( field " handle" UserHandle . decodeUnprefixed)
102
104
( maybe ( field " name" string))
103
105
( maybe ( field " avatarUrl" decodeUrl))
104
106
( maybe ( field " completedTours" ( Decode . list Tour . decode)))
105
107
( field " organizationMemberships" ( Decode . list ( Decode . map OrganizationMembership UserHandle . decodeUnprefixed)))
108
+ ( field " isSuperAdmin" Decode . bool)
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ view : Session -> Http.Error -> String -> String -> PageLayout msg
17
17
view session error entityName className =
18
18
let
19
19
errorDetails =
20
- if Session . isUnisonMember session then
20
+ if Session . isSuperAdmin session then
21
21
details [] [ summary [] [ text " Error Details" ], div [] [ text ( Util . httpErrorToString error) ] ]
22
22
23
23
else
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ module UnisonShare.Session exposing
7
7
, isOrganizationMember
8
8
, isProjectOwner
9
9
, isSignedIn
10
+ , isSuperAdmin
10
11
, isUnisonMember
11
12
)
12
13
@@ -41,6 +42,16 @@ isSignedIn session =
41
42
True
42
43
43
44
45
+ isSuperAdmin : Session -> Bool
46
+ isSuperAdmin session =
47
+ case session of
48
+ Anonymous ->
49
+ False
50
+
51
+ SignedIn account_ ->
52
+ account_. isSuperAdmin
53
+
54
+
44
55
isProjectOwner : ProjectRef -> Session -> Bool
45
56
isProjectOwner projectRef session =
46
57
isHandle ( ProjectRef . handle projectRef) session
You can’t perform that action at this time.
0 commit comments