Change names of struct fields in adaptor

This commit is contained in:
Ingo Oppermann
2023-01-13 10:19:41 +01:00
parent c9c965b38e
commit 05cc764ded
4 changed files with 97 additions and 4 deletions

View File

@@ -478,7 +478,7 @@ func (a *adapter) GetAllGroupNames() []string {
type Group struct { type Group struct {
Name string `json:"name"` Name string `json:"name"`
Roles map[string][]Role `json:"roles"` Roles map[string][]Role `json:"roles"`
UserRoles []MapUserRole `json:"users"` UserRoles []MapUserRole `json:"userroles"`
Policies []Policy `json:"policies"` Policies []Policy `json:"policies"`
} }

Binary file not shown.

View File

@@ -73,7 +73,7 @@
} }
] ]
}, },
"users": [ "userroles": [
{ {
"username": "alice", "username": "alice",
"role": "admin" "role": "admin"
@@ -105,7 +105,7 @@
} }
] ]
}, },
"users": [ "userroles": [
{ {
"username": "$anon", "username": "$anon",
"role": "anonymous" "role": "anonymous"
@@ -191,7 +191,7 @@
} }
] ]
}, },
"users": [ "userroles": [
{ {
"username": "franz", "username": "franz",
"role": "admin" "role": "admin"

93
app/casbin/users.json Normal file
View File

@@ -0,0 +1,93 @@
[
{
"name": "alice",
"superuser": false,
"auth": {
"api": {
"userpass": {
"enable": true,
"username": "foo",
"password": "bar"
},
"auth0": {
"enable": true,
"user": "google|42",
"tenant": "tenant1"
}
},
"http": {
"basic": {
"enable": true,
"username": "bar",
"password": "baz"
}
},
"rtmp": {
"enable": true,
"token": "abc123"
},
"srt": {
"enable": true,
"token": "xyz987"
}
}
},
{
"name": "bob",
"superuser": true,
"auth": {
"api": {
"userpass": {
"enable": true,
"username": "foo",
"password": "baz"
},
"auth0": {
"enable": true,
"user": "github|88",
"tenant": "tenant2"
}
},
"http": {
"basic": {
"enable": true,
"username": "boz",
"password": "bok"
}
},
"rtmp": {
"enable": true,
"token": "abc456"
},
"srt": {
"enable": true,
"token": "xyz654"
}
}
},
{
"name": "$anon",
"superuser": false,
"auth": {
"api": {
"userpass": {
"enable": false
},
"auth0": {
"enable": false
}
},
"http": {
"basic": {
"enable": false
}
},
"rtmp": {
"enable": false
},
"srt": {
"enable": false
}
}
}
]