security/authorization/authorization.go
2024-09-30 19:02:10 -04:00

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
}