44 lines
653 B
Go
44 lines
653 B
Go
package authorization
|
|
|
|
import "somehole.com/common/security/identity"
|
|
|
|
type Verb int
|
|
|
|
const (
|
|
_ Verb = iota
|
|
Create
|
|
Read
|
|
Watch
|
|
Update
|
|
Patch
|
|
Delete
|
|
)
|
|
|
|
type Noun int
|
|
|
|
const (
|
|
_ Noun = iota
|
|
Identity
|
|
Command
|
|
Log
|
|
)
|
|
|
|
type AuthorizationService struct {
|
|
*AuditService
|
|
}
|
|
|
|
func NewAuthorizationService(auditService *AuditService) (srv *AuthorizationService) {
|
|
if auditService == nil {
|
|
auditService = NewAuditService()
|
|
}
|
|
srv = &AuthorizationService{
|
|
AuditService: auditService,
|
|
}
|
|
return
|
|
}
|
|
|
|
func (srv *AuthorizationService) Authorized(identity identity.Identity, verb Verb, noun Noun) (authorized bool, err error) {
|
|
authorized = true
|
|
return
|
|
}
|