diff --git a/casdoorsdk/role.go b/casdoorsdk/role.go new file mode 100644 index 0000000..72be752 --- /dev/null +++ b/casdoorsdk/role.go @@ -0,0 +1,27 @@ +// Copyright 2022 The casbin Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package casdoorsdk + +// Role has the same definition as https://github.com/casdoor/casdoor/blob/master/object/role.go#L24 +type Role struct { + Owner string `json:"owner"` + Name string `json:"name"` + CreatedTime string `json:"createdTime"` + DisplayName string `json:"displayName"` + + Users []string `json:"users"` + Roles []string `json:"roles"` + IsEnabled bool `json:"isEnabled"` +} diff --git a/casdoorsdk/user.go b/casdoorsdk/user.go index c3aafc3..6a7d915 100644 --- a/casdoorsdk/user.go +++ b/casdoorsdk/user.go @@ -82,6 +82,9 @@ type User struct { Ldap string `json:"ldap"` Properties map[string]string `json:"properties"` + + Roles []*Role `json:"roles"` + Permissions []*Permission `json:"permissions"` } func GetUsers() ([]*User, error) {