Documentation
¶
Index ¶
- Variables
- func Generate() string
- func IsDefinitionError(err error) bool
- func NewDBErr(err error) error
- type DBErr
- type ID
- type IPermissions
- type Key
- type ModelError
- type Name
- type Node
- type Organization
- type OrganizationUserRole
- type OrganizationUserRoles
- type Organizations
- type Permission
- type Permissions
- type Resource
- type ResourceCheck
- type Role
- type Roles
- type String
- type User
- type Users
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRequired `Required field of empty` ErrRequired = status.Error(http.StatusBadRequest, "Required field of empty") // ErrNoData `No data found` ErrNoData = status.Error(http.StatusNotFound, "No data found") // ErrAlreadyExists `Already exists` ErrAlreadyExists = status.Error(http.StatusConflict, "Already exists") )
Functions ¶
func IsDefinitionError ¶
Types ¶
type IPermissions ¶
type IPermissions func() []string
type ModelError ¶
type ModelError struct {
// contains filtered or unexported fields
}
func (ModelError) Error ¶
func (e ModelError) Error() string
type Organization ¶
type Organization struct {
// contains filtered or unexported fields
}
func NewOrganization ¶
func NewOrganization(id, name, description string, users ...User) (*Organization, error)
func (*Organization) GetDescription ¶
func (o *Organization) GetDescription() string
func (*Organization) GetUsers ¶
func (o *Organization) GetUsers() Users
func (*Organization) IsContainsUsers ¶
func (o *Organization) IsContainsUsers(userKey Key) (*User, bool)
type OrganizationUserRole ¶
type OrganizationUserRole struct {
// contains filtered or unexported fields
}
func NewOrganizationUserRole ¶
func NewOrganizationUserRole(organization Organization, userKey, roleId string) (*OrganizationUserRole, error)
func (*OrganizationUserRole) GetOrganization ¶
func (m *OrganizationUserRole) GetOrganization() Organization
func (*OrganizationUserRole) GetRoleId ¶
func (m *OrganizationUserRole) GetRoleId() string
func (*OrganizationUserRole) GetUserKey ¶
func (m *OrganizationUserRole) GetUserKey() string
type OrganizationUserRoles ¶
type OrganizationUserRoles []OrganizationUserRole
func (OrganizationUserRoles) Copy ¶
func (arr OrganizationUserRoles) Copy() OrganizationUserRoles
type Organizations ¶
type Organizations []Organization
func (Organizations) Copy ¶
func (arr Organizations) Copy() Organizations
type Permission ¶
type Permission struct {
// contains filtered or unexported fields
}
func NewPermission ¶
func NewPermission(id, name, description string) (*Permission, error)
func (*Permission) GetDescription ¶
func (p *Permission) GetDescription() string
type Permissions ¶
type Permissions []Permission
func (Permissions) Copy ¶
func (arr Permissions) Copy() Permissions
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
func NewResource ¶
func NewResourceByMethod ¶
type ResourceCheck ¶
type ResourceCheck struct {
// contains filtered or unexported fields
}
func NewResourceCheck ¶
func NewResourceCheck(result bool, message string) *ResourceCheck
func (*ResourceCheck) GetMsg ¶
func (r *ResourceCheck) GetMsg() string
func (*ResourceCheck) IsOk ¶
func (r *ResourceCheck) IsOk() bool
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
func NewRole ¶
func NewRole(id, name, description string, permissions Permissions, organizationUserRoles ...OrganizationUserRole) (*Role, error)
func (*Role) AddPermission ¶
func (r *Role) AddPermission(permissions ...Permission)
AddPermission is only the permission that exists in the database
func (*Role) GetDescription ¶
func (*Role) GetOrganizationUserRoles ¶
func (r *Role) GetOrganizationUserRoles() OrganizationUserRoles
func (*Role) GetPermissions ¶
func (r *Role) GetPermissions() Permissions
type User ¶
type User struct {
// contains filtered or unexported fields
}
func (*User) GetPermission ¶
func (u *User) GetPermission() []Permission
func (*User) IsContainsPermission ¶
func (*User) IsContainsPermissionByName ¶
Click to show internal directories.
Click to hide internal directories.