Documentation ¶
Index ¶
Constants ¶
View Source
const SuperUserRoleName = "superuser"
Variables ¶
View Source
var SuperuserRole = NewRole(SuperUserRoleName, AdminsScope, StatsScope, )
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct { ID int64 `bson:"id, omitempty"` Role *Role `bson:"role,omitempty"` Notifications *Notifications `bson:"notifications,omitempty"` }
type AdminNotFound ¶
type AdminNotFound int64
func (AdminNotFound) Error ¶
func (e AdminNotFound) Error() string
type AdminsRepo ¶
type AdminsRepo interface { Create(ctx context.Context, admins ...*Admin) ([]*Admin, error) CreateIfNotExists(ctx context.Context, admins ...*Admin) ([]*Admin, error) AssignRoleByID(ctx context.Context, roleName string, adminID int64) (*Admin, error) AssignRoleByIDs(ctx context.Context, roleName string, adminIDs ...int64) ([]*Admin, error) GetAll(ctx context.Context) ([]*Admin, error) GetAllShouldBeNotifiedAbout(ctx context.Context, notificationType NotificationType) ([]*Admin, error) GetByID(ctx context.Context, adminID int64) (*Admin, error) GetByIDs(ctx context.Context, adminIDs ...int64) ([]*Admin, error) GetRoleByID(ctx context.Context, adminID int64) (*Role, error) HasScopesByID(ctx context.Context, adminID int64, scopes ...Scope) (bool, error) DeleteByIDs(ctx context.Context, adminIDs ...int64) error }
type NotificationType ¶
type NotificationType string
const (
StatusNotificationType NotificationType = "status"
)
type Notifications ¶
type Notifications struct {
Status []NotifierType `bson:"status,omitempty"`
}
type RolesRepo ¶
type RolesRepo interface { Create(ctx context.Context, roles ...*Role) ([]*Role, error) CreateIfNotExists(ctx context.Context, roles ...*Role) ([]*Role, error) GetAll(ctx context.Context) ([]*Role, error) GetByName(ctx context.Context, name string) (*Role, error) GetByNames(ctx context.Context, names ...string) ([]*Role, error) AddScopes(ctx context.Context, scopes []Scope, names ...string) ([]*Role, error) SetScopes(ctx context.Context, scopes []Scope, names ...string) ([]*Role, error) DeleteByNames(ctx context.Context, names ...string) error }
type Scopes ¶
type Scopes map[Scope]struct{}
func (Scopes) MarshalBSON ¶
func (Scopes) UnmarshalBSON ¶
Click to show internal directories.
Click to hide internal directories.