Skip to content

Commit

Permalink
fix(rbac): roles sys unique id
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrix-X committed Aug 10, 2022
1 parent c865810 commit 7e6fdf9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions authorization/rbac/models/role.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package models

import (
"fmt"
"github.com/ArtisanCloud/PowerLibs/v2/database"
"github.com/ArtisanCloud/PowerLibs/v2/object"
"github.com/ArtisanCloud/PowerLibs/v2/security"
Expand Down Expand Up @@ -74,28 +73,28 @@ func (mdl *Role) GetForeignValue() string {

func (mdl *Role) GetComposedUniqueID() string {

strKey := fmt.Sprintf("%d", mdl.ParentID) + "-" + mdl.Name
strKey := *mdl.ParentID + "-" + mdl.Name
hashKey := security.HashStringData(strKey)

return hashKey
}

func (mdl *Role) GetRootComposedUniqueID() string {
strKey := fmt.Sprintf("%d", 0) + "-" + ROLE_ROOT_NAME
strKey := "" + "-" + ROLE_ROOT_NAME
hashKey := security.HashStringData(strKey)

return hashKey
}

func (mdl *Role) GetAdminComposedUniqueID() string {
strKey := fmt.Sprintf("%d", 0) + "-" + ROLE_ADMIN_NAME
strKey := "" + "-" + ROLE_ADMIN_NAME
hashKey := security.HashStringData(strKey)

return hashKey
}

func (mdl *Role) GetEmployeeComposedUniqueID() string {
strKey := fmt.Sprintf("%d", 0) + "-" + ROLE_EMPLOYEE_NAME
strKey := "" + "-" + ROLE_EMPLOYEE_NAME
hashKey := security.HashStringData(strKey)

return hashKey
Expand Down

0 comments on commit 7e6fdf9

Please sign in to comment.