Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessPermission ¶
type AccessPermission struct { ID uint `gorm:"primary_key; AUTO_INCREMENT"` ResourcePattern string `gorm:"not nul"` Action string `gorm:"not nul"` RoleID uint }
AccessPermission defines access pemission of a role towards a resource offered by a service
type DataAccess ¶
type DataAccess struct {
// contains filtered or unexported fields
}
DataAccess wraps access to the database and implements utility requests
func NewDataAccess ¶
func NewDataAccess(dialect, dsn string) *DataAccess
NewDataAccess creates a new DataAccess
func (*DataAccess) GetServiceByName ¶
func (da *DataAccess) GetServiceByName(name string) (srv *Service, err error)
GetServiceByName get service by name
func (*DataAccess) GetUserAccessPermissionsByService ¶
func (da *DataAccess) GetUserAccessPermissionsByService(email, serviceName string) (permissions []AccessPermission, err error)
GetUserAccessPermissionsByService get user access permission by service
func (*DataAccess) Init ¶
func (da *DataAccess) Init() (err error)
Init initialize the database: drop tables if exists and create new empty ones
type Role ¶
type Role struct { ID uint `gorm:"primary_key; AUTO_INCREMENT"` Name string ServiceID uint AccessPermissions []AccessPermission Users []User `gorm:"many2many:user_roles;" ` }
Role define a role relative to a service
Click to show internal directories.
Click to hide internal directories.