Skip to content

Commit

Permalink
feat: add roles and permissions for user (#33)
Browse files Browse the repository at this point in the history
* feat: add roles and permissions for user

* Delete xorm tag for role
  • Loading branch information
Resulte authored Aug 5, 2022
1 parent c37aa28 commit 55c9f7e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
27 changes: 27 additions & 0 deletions casdoorsdk/role.go
Original file line number Diff line number Diff line change
@@ -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"`
}
3 changes: 3 additions & 0 deletions casdoorsdk/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 55c9f7e

Please sign in to comment.