package authz import ( "strings" "git.rosy.net.cn/baseapi/utils" ) const ( RoleNameSep = "/" RolePrefix = "role" StoreRolePrefix = "store" ) func GenStoreRoleName(storeID int) (roleName string) { return strings.Join([]string{ RolePrefix, StoreRolePrefix, utils.Int2Str(storeID), }, RoleNameSep) } func GetStoreIDFromRole(roleName string) (storeID int) { list := strings.Split(roleName, RoleNameSep) if len(list) == 3 { storeID = int(utils.Str2Int64WithDefault(list[2], 0)) } return storeID }