security/authorization/authorization.go

44 lines
653 B
Go
Raw Normal View History

2024-09-30 23:02:10 +00:00
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
}