@@ -35,6 +35,7 @@ test_openfga() {
35
35
echo " ==> Checking permissions for unknown user..."
36
36
user_is_not_server_admin
37
37
user_is_not_server_operator
38
+ user_is_not_server_viewer
38
39
user_is_not_project_admin
39
40
user_is_not_project_operator
40
41
@@ -105,6 +106,14 @@ test_openfga() {
105
106
shutdown_openfga
106
107
}
107
108
109
+ user_is_not_server_viewer () {
110
+ # Should still be able to list certificates.
111
+ [ " $( incus config trust list oidc-openfga: -f csv -cf | wc -l) " = 1 ]
112
+
113
+ # Cannot see any config.
114
+ ! incus info oidc-openfga: | grep -Fq ' core.https_address' || false
115
+ }
116
+
108
117
user_is_not_server_admin () {
109
118
# Can always see server info (type-bound public access https://openfga.dev/docs/modeling/public-access).
110
119
incus info oidc-openfga: > /dev/null
@@ -125,13 +134,6 @@ user_is_not_server_admin() {
125
134
126
135
# Should not be able to create a storage pool.
127
136
! incus storage create oidc-openfga:test dir || false
128
-
129
- # Should still be able to list certificates.
130
- [ " $( incus config trust list oidc-openfga: -f csv -cf | wc -l) " = 1 ]
131
-
132
- # Cannot edit certificates.
133
- fingerprint=" $( incus config trust list -f csv -cf) "
134
- ! incus config trust show " ${fingerprint} " | sed -e " s/restricted: false/restricted: true/" | incus config trust edit " oidc-openfga:${fingerprint} " || false
135
137
}
136
138
137
139
user_is_not_server_operator () {
@@ -204,7 +206,6 @@ user_is_project_operator() {
204
206
}
205
207
206
208
user_is_not_project_operator () {
207
-
208
209
# Project list will not fail but there will be no output.
209
210
[ " $( incus project list oidc-openfga: -f csv | wc -l) " = 0 ]
210
211
! incus project show oidc-openfga:default || false
0 commit comments