Skip to content

Commit

Permalink
when the role is 'root', return * perm.
Browse files Browse the repository at this point in the history
  • Loading branch information
horizonzy committed May 16, 2021
1 parent 9501e8e commit 77a73d4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/auth/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ var (
authEnabled = []byte{1}
authDisabled = []byte{0}

rootPerm = authpb.Permission{PermType: authpb.READWRITE, Key: []byte("*")}

revisionKey = []byte("authRevision")

authBucketName = []byte("auth")
Expand Down Expand Up @@ -624,6 +626,10 @@ func (as *authStore) UserRevokeRole(r *pb.AuthUserRevokeRoleRequest) (*pb.AuthUs
}

func (as *authStore) RoleGet(r *pb.AuthRoleGetRequest) (*pb.AuthRoleGetResponse, error) {
if rootRole == r.Role {
return &pb.AuthRoleGetResponse{Header: &pb.ResponseHeader{}, Perm: []*authpb.Permission{&rootPerm}}, nil
}

tx := as.be.BatchTx()
tx.Lock()
defer tx.Unlock()
Expand Down

0 comments on commit 77a73d4

Please sign in to comment.