@@ -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,12 +106,17 @@ test_openfga() {
105
106
shutdown_openfga
106
107
}
107
108
108
- user_is_not_server_admin () {
109
- # Can always see server info (type-bound public access https://openfga.dev/docs/modeling/public-access) .
110
- incus info oidc-openfga: > /dev/null
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 ) " = 0 ]
111
112
112
113
# Cannot see any config.
113
114
! incus info oidc-openfga: | grep -Fq ' core.https_address' || false
115
+ }
116
+
117
+ user_is_not_server_admin () {
118
+ # Can always see server info (type-bound public access https://openfga.dev/docs/modeling/public-access).
119
+ incus info oidc-openfga: > /dev/null
114
120
115
121
# Cannot set any config.
116
122
! incus config set oidc-openfga: core.proxy_https=https://example.com || false
@@ -125,13 +131,6 @@ user_is_not_server_admin() {
125
131
126
132
# Should not be able to create a storage pool.
127
133
! 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
134
}
136
135
137
136
user_is_not_server_operator () {
@@ -204,7 +203,6 @@ user_is_project_operator() {
204
203
}
205
204
206
205
user_is_not_project_operator () {
207
-
208
206
# Project list will not fail but there will be no output.
209
207
[ " $( incus project list oidc-openfga: -f csv | wc -l) " = 0 ]
210
208
! incus project show oidc-openfga:default || false
0 commit comments