Refactor authentication & authorization modules

This commit is contained in:
cuigh
2018-02-24 12:26:38 +08:00
parent 81081c8164
commit 5b60a024c5
14 changed files with 340 additions and 335 deletions

View File

@@ -2,6 +2,8 @@ package model
import (
"time"
"github.com/cuigh/auxo/data"
)
type UserType string
@@ -13,8 +15,6 @@ const (
UserTypeLDAP UserType = "ldap"
)
var Placeholder = struct{}{}
type UserStatus int32
const (
@@ -80,7 +80,7 @@ func NewAuthUser(user *User, roles []*Role) *AuthUser {
}
for _, role := range roles {
for _, perm := range role.Perms {
u.perms[perm] = Placeholder
u.perms[perm] = data.Empty
}
}
return u