Documentation ¶
Index ¶
- Constants
- Variables
- type GroupCriteria
- type GroupEntity
- type GroupIterator
- type GroupPatch
- type GroupPermissionsCriteria
- type GroupPermissionsEntity
- type GroupPermissionsIterator
- func (i *GroupPermissionsIterator) Close() error
- func (i *GroupPermissionsIterator) Columns() ([]string, error)
- func (i *GroupPermissionsIterator) Ent() (interface{}, error)
- func (i *GroupPermissionsIterator) Err() error
- func (i *GroupPermissionsIterator) GroupPermissions() (*GroupPermissionsEntity, error)
- func (i *GroupPermissionsIterator) Next() bool
- type GroupPermissionsPatch
- type GroupPermissionsProvider
- type GroupPermissionsRepository
- type GroupPermissionsRepositoryBase
- func (r *GroupPermissionsRepositoryBase) Count(c *GroupPermissionsCriteria) (int64, error)
- func (r *GroupPermissionsRepositoryBase) Find(c *GroupPermissionsCriteria) ([]*GroupPermissionsEntity, error)
- func (r *GroupPermissionsRepositoryBase) FindIter(c *GroupPermissionsCriteria) (*GroupPermissionsIterator, error)
- func (r *GroupPermissionsRepositoryBase) FindOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(groupPermissionsGroupID int64, groupPermissionsPermissionSubsystem string, ...) (*GroupPermissionsEntity, error)
- func (r *GroupPermissionsRepositoryBase) Insert(e *GroupPermissionsEntity) (*GroupPermissionsEntity, error)
- func (r *GroupPermissionsRepositoryBase) UpdateOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(groupPermissionsGroupID int64, groupPermissionsPermissionSubsystem string, ...) (*GroupPermissionsEntity, error)
- func (r *GroupPermissionsRepositoryBase) Upsert(e *GroupPermissionsEntity, p *GroupPermissionsPatch, inf ...string) (*GroupPermissionsEntity, error)
- type GroupProvider
- type GroupRepository
- func (gr *GroupRepository) Create(createdBy int64, name string, description *ntypes.String) (ent *GroupEntity, err error)
- func (gr *GroupRepository) FindByUserID(userID int64) ([]*GroupEntity, error)
- func (gr *GroupRepository) IsGranted(id int64, p charon.Permission) (bool, error)
- func (gr *GroupRepository) SetPermissions(id int64, p ...charon.Permission) (int64, int64, error)
- func (gr *GroupRepository) UpdateOneByID(id, updatedBy int64, name, description *ntypes.String) (*GroupEntity, error)
- type GroupRepositoryBase
- func (r *GroupRepositoryBase) Count(c *GroupCriteria) (int64, error)
- func (r *GroupRepositoryBase) DeleteOneByID(id int64) (int64, error)
- func (r *GroupRepositoryBase) Find(c *GroupCriteria) ([]*GroupEntity, error)
- func (r *GroupRepositoryBase) FindIter(c *GroupCriteria) (*GroupIterator, error)
- func (r *GroupRepositoryBase) FindOneByID(id int64) (*GroupEntity, error)
- func (r *GroupRepositoryBase) FindOneByName(groupName string) (*GroupEntity, error)
- func (r *GroupRepositoryBase) Insert(e *GroupEntity) (*GroupEntity, error)
- func (r *GroupRepositoryBase) UpdateOneByID(id int64, patch *GroupPatch) (*GroupEntity, error)
- func (r *GroupRepositoryBase) UpdateOneByName(groupName string, patch *GroupPatch) (*GroupEntity, error)
- func (r *GroupRepositoryBase) Upsert(e *GroupEntity, p *GroupPatch, inf ...string) (*GroupEntity, error)
- type MockGroupPermissionsProvider
- type MockGroupProvider
- func (_m *MockGroupProvider) Create(createdBy int64, name string, description *ntypes.String) (*GroupEntity, error)
- func (_m *MockGroupProvider) DeleteOneByID(id int64) (int64, error)
- func (_m *MockGroupProvider) Find(c *GroupCriteria) ([]*GroupEntity, error)
- func (_m *MockGroupProvider) FindByUserID(_a0 int64) ([]*GroupEntity, error)
- func (_m *MockGroupProvider) FindOneByID(_a0 int64) (*GroupEntity, error)
- func (_m *MockGroupProvider) Insert(entity *GroupEntity) (*GroupEntity, error)
- func (_m *MockGroupProvider) IsGranted(id int64, permission charon.Permission) (bool, error)
- func (_m *MockGroupProvider) SetPermissions(id int64, permissions ...charon.Permission) (int64, int64, error)
- func (_m *MockGroupProvider) UpdateOneByID(id int64, updatedBy int64, name *ntypes.String, description *ntypes.String) (*GroupEntity, error)
- type MockPermissionProvider
- func (_m *MockPermissionProvider) Find(criteria *PermissionCriteria) ([]*PermissionEntity, error)
- func (_m *MockPermissionProvider) FindByGroupID(groupID int64) ([]*PermissionEntity, error)
- func (_m *MockPermissionProvider) FindByUserID(userID int64) ([]*PermissionEntity, error)
- func (_m *MockPermissionProvider) FindOneByID(id int64) (*PermissionEntity, error)
- func (_m *MockPermissionProvider) Insert(entity *PermissionEntity) (*PermissionEntity, error)
- func (_m *MockPermissionProvider) Register(permissions charon.Permissions) (int64, int64, int64, error)
- type MockPermissionRegistry
- type MockUserGroupsProvider
- func (_m *MockUserGroupsProvider) DeleteByUserID(id int64) (int64, error)
- func (_m *MockUserGroupsProvider) Exists(userID int64, groupID int64) (bool, error)
- func (_m *MockUserGroupsProvider) Find(criteria *UserGroupsCriteria) ([]*UserGroupsEntity, error)
- func (_m *MockUserGroupsProvider) Insert(entity *UserGroupsEntity) (*UserGroupsEntity, error)
- func (_m *MockUserGroupsProvider) Set(userID int64, groupIDs []int64) (int64, int64, error)
- type MockUserPermissionsProvider
- type MockUserProvider
- func (_m *MockUserProvider) ChangePassword(id int64, password string) error
- func (_m *MockUserProvider) Count() (int64, error)
- func (_m *MockUserProvider) Create(username string, password []byte, FirstName string, LastName string, ...) (*UserEntity, error)
- func (_m *MockUserProvider) CreateSuperuser(username string, password []byte, FirstName string, LastName string) (*UserEntity, error)
- func (_m *MockUserProvider) DeleteOneByID(id int64) (int64, error)
- func (_m *MockUserProvider) Exists(id int64) (bool, error)
- func (_m *MockUserProvider) Find(criteria *UserCriteria) ([]*UserEntity, error)
- func (_m *MockUserProvider) FindOneByID(id int64) (*UserEntity, error)
- func (_m *MockUserProvider) FindOneByUsername(username string) (*UserEntity, error)
- func (_m *MockUserProvider) Insert(_a0 *UserEntity) (*UserEntity, error)
- func (_m *MockUserProvider) IsGranted(id int64, permission charon.Permission) (bool, error)
- func (_m *MockUserProvider) RegistrationConfirmation(id int64, confirmationToken string) error
- func (_m *MockUserProvider) SetPermissions(id int64, permissions ...charon.Permission) (int64, int64, error)
- func (_m *MockUserProvider) UpdateLastLoginAt(id int64) (int64, error)
- func (_m *MockUserProvider) UpdateOneByID(_a0 int64, _a1 *UserPatch) (*UserEntity, error)
- type PermissionCriteria
- type PermissionEntity
- type PermissionIterator
- func (i *PermissionIterator) Close() error
- func (i *PermissionIterator) Columns() ([]string, error)
- func (i *PermissionIterator) Ent() (interface{}, error)
- func (i *PermissionIterator) Err() error
- func (i *PermissionIterator) Next() bool
- func (i *PermissionIterator) Permission() (*PermissionEntity, error)
- type PermissionPatch
- type PermissionProvider
- type PermissionReg
- type PermissionRegistry
- type PermissionRepository
- func (pr *PermissionRepository) FindBy(query string, args ...interface{}) ([]*PermissionEntity, error)
- func (pr *PermissionRepository) FindByGroupID(userID int64) ([]*PermissionEntity, error)
- func (pr *PermissionRepository) FindByTag(userID int64) ([]*PermissionEntity, error)
- func (pr *PermissionRepository) FindByUserID(userID int64) ([]*PermissionEntity, error)
- func (pr *PermissionRepository) Register(permissions charon.Permissions) (created, unt, removed int64, err error)
- type PermissionRepositoryBase
- func (r *PermissionRepositoryBase) Count(c *PermissionCriteria) (int64, error)
- func (r *PermissionRepositoryBase) DeleteOneByID(id int64) (int64, error)
- func (r *PermissionRepositoryBase) Find(c *PermissionCriteria) ([]*PermissionEntity, error)
- func (r *PermissionRepositoryBase) FindIter(c *PermissionCriteria) (*PermissionIterator, error)
- func (r *PermissionRepositoryBase) FindOneByID(id int64) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) FindOneBySubsystemAndModuleAndAction(permissionSubsystem string, permissionModule string, permissionAction string) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) Insert(e *PermissionEntity) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) UpdateOneByID(id int64, patch *PermissionPatch) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) UpdateOneBySubsystemAndModuleAndAction(permissionSubsystem string, permissionModule string, permissionAction string, ...) (*PermissionEntity, error)
- func (r *PermissionRepositoryBase) Upsert(e *PermissionEntity, p *PermissionPatch, inf ...string) (*PermissionEntity, error)
- type UserCriteria
- type UserEntity
- type UserGroupsCriteria
- type UserGroupsEntity
- type UserGroupsIterator
- func (i *UserGroupsIterator) Close() error
- func (i *UserGroupsIterator) Columns() ([]string, error)
- func (i *UserGroupsIterator) Ent() (interface{}, error)
- func (i *UserGroupsIterator) Err() error
- func (i *UserGroupsIterator) Next() bool
- func (i *UserGroupsIterator) UserGroups() (*UserGroupsEntity, error)
- type UserGroupsPatch
- type UserGroupsProvider
- type UserGroupsRepository
- type UserGroupsRepositoryBase
- func (r *UserGroupsRepositoryBase) Count(c *UserGroupsCriteria) (int64, error)
- func (r *UserGroupsRepositoryBase) Find(c *UserGroupsCriteria) ([]*UserGroupsEntity, error)
- func (r *UserGroupsRepositoryBase) FindIter(c *UserGroupsCriteria) (*UserGroupsIterator, error)
- func (r *UserGroupsRepositoryBase) FindOneByUserIDAndGroupID(userGroupsUserID int64, userGroupsGroupID int64) (*UserGroupsEntity, error)
- func (r *UserGroupsRepositoryBase) Insert(e *UserGroupsEntity) (*UserGroupsEntity, error)
- func (r *UserGroupsRepositoryBase) UpdateOneByUserIDAndGroupID(userGroupsUserID int64, userGroupsGroupID int64, patch *UserGroupsPatch) (*UserGroupsEntity, error)
- func (r *UserGroupsRepositoryBase) Upsert(e *UserGroupsEntity, p *UserGroupsPatch, inf ...string) (*UserGroupsEntity, error)
- type UserIterator
- type UserPatch
- type UserPermissionsCriteria
- type UserPermissionsEntity
- type UserPermissionsIterator
- func (i *UserPermissionsIterator) Close() error
- func (i *UserPermissionsIterator) Columns() ([]string, error)
- func (i *UserPermissionsIterator) Ent() (interface{}, error)
- func (i *UserPermissionsIterator) Err() error
- func (i *UserPermissionsIterator) Next() bool
- func (i *UserPermissionsIterator) UserPermissions() (*UserPermissionsEntity, error)
- type UserPermissionsPatch
- type UserPermissionsProvider
- type UserPermissionsRepository
- type UserPermissionsRepositoryBase
- func (r *UserPermissionsRepositoryBase) Count(c *UserPermissionsCriteria) (int64, error)
- func (r *UserPermissionsRepositoryBase) Find(c *UserPermissionsCriteria) ([]*UserPermissionsEntity, error)
- func (r *UserPermissionsRepositoryBase) FindIter(c *UserPermissionsCriteria) (*UserPermissionsIterator, error)
- func (r *UserPermissionsRepositoryBase) FindOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(userPermissionsUserID int64, userPermissionsPermissionSubsystem string, ...) (*UserPermissionsEntity, error)
- func (r *UserPermissionsRepositoryBase) Insert(e *UserPermissionsEntity) (*UserPermissionsEntity, error)
- func (r *UserPermissionsRepositoryBase) UpdateOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(userPermissionsUserID int64, userPermissionsPermissionSubsystem string, ...) (*UserPermissionsEntity, error)
- func (r *UserPermissionsRepositoryBase) Upsert(e *UserPermissionsEntity, p *UserPermissionsPatch, inf ...string) (*UserPermissionsEntity, error)
- type UserProvider
- type UserRepository
- func (ur *UserRepository) ChangePassword(userID int64, password string) error
- func (ur *UserRepository) Count() (n int64, err error)
- func (ur *UserRepository) Create(username string, password []byte, firstName, lastName string, ...) (*UserEntity, error)
- func (ur *UserRepository) CreateSuperuser(username string, password []byte, FirstName, LastName string) (*UserEntity, error)
- func (ur *UserRepository) Exists(userID int64) (bool, error)
- func (ur *UserRepository) FindOneBy(fieldName string, value interface{}) (*UserEntity, error)
- func (ur *UserRepository) FindOneByUsername(username string) (*UserEntity, error)
- func (ur *UserRepository) IsGranted(id int64, p charon.Permission) (bool, error)
- func (ur *UserRepository) RegistrationConfirmation(userID int64, confirmationToken string) error
- func (ur *UserRepository) SetPermissions(id int64, p ...charon.Permission) (int64, int64, error)
- func (ur *UserRepository) UpdateLastLoginAt(userID int64) (int64, error)
- type UserRepositoryBase
- func (r *UserRepositoryBase) Count(c *UserCriteria) (int64, error)
- func (r *UserRepositoryBase) DeleteOneByID(id int64) (int64, error)
- func (r *UserRepositoryBase) Find(c *UserCriteria) ([]*UserEntity, error)
- func (r *UserRepositoryBase) FindIter(c *UserCriteria) (*UserIterator, error)
- func (r *UserRepositoryBase) FindOneByID(id int64) (*UserEntity, error)
- func (r *UserRepositoryBase) FindOneByUsername(userUsername string) (*UserEntity, error)
- func (r *UserRepositoryBase) Insert(e *UserEntity) (*UserEntity, error)
- func (r *UserRepositoryBase) UpdateOneByID(id int64, patch *UserPatch) (*UserEntity, error)
- func (r *UserRepositoryBase) UpdateOneByUsername(userUsername string, patch *UserPatch) (*UserEntity, error)
- func (r *UserRepositoryBase) Upsert(e *UserEntity, p *UserPatch, inf ...string) (*UserEntity, error)
Constants ¶
const ( TableUser = "charon.user" TableUserColumnConfirmationToken = "confirmation_token" TableUserColumnCreatedAt = "created_at" TableUserColumnCreatedBy = "created_by" TableUserColumnFirstName = "first_name" TableUserColumnID = "id" TableUserColumnIsActive = "is_active" TableUserColumnIsConfirmed = "is_confirmed" TableUserColumnIsStaff = "is_staff" TableUserColumnIsSuperuser = "is_superuser" TableUserColumnLastLoginAt = "last_login_at" TableUserColumnLastName = "last_name" TableUserColumnPassword = "password" TableUserColumnUpdatedAt = "updated_at" TableUserColumnUpdatedBy = "updated_by" TableUserColumnUsername = "username" TableUserConstraintCreatedByForeignKey = "charon.user_created_by_fkey" TableUserConstraintPrimaryKey = "charon.user_id_pkey" TableUserConstraintUpdatedByForeignKey = "charon.user_updated_by_fkey" TableUserConstraintUsernameUnique = "charon.user_username_key" )
const ( TableGroup = "charon.group" TableGroupColumnCreatedAt = "created_at" TableGroupColumnCreatedBy = "created_by" TableGroupColumnDescription = "description" TableGroupColumnID = "id" TableGroupColumnName = "name" TableGroupColumnUpdatedAt = "updated_at" TableGroupColumnUpdatedBy = "updated_by" TableGroupConstraintCreatedByForeignKey = "charon.group_created_by_fkey" TableGroupConstraintPrimaryKey = "charon.group_id_pkey" TableGroupConstraintNameUnique = "charon.group_name_key" TableGroupConstraintUpdatedByForeignKey = "charon.group_updated_by_fkey" )
const ( TablePermission = "charon.permission" TablePermissionColumnAction = "action" TablePermissionColumnCreatedAt = "created_at" TablePermissionColumnID = "id" TablePermissionColumnModule = "module" TablePermissionColumnSubsystem = "subsystem" TablePermissionColumnUpdatedAt = "updated_at" TablePermissionConstraintPrimaryKey = "charon.permission_id_pkey" TablePermissionConstraintSubsystemModuleActionUnique = "charon.permission_subsystem_module_action_key" )
const ( TableUserGroups = "charon.user_groups" TableUserGroupsColumnCreatedAt = "created_at" TableUserGroupsColumnCreatedBy = "created_by" TableUserGroupsColumnGroupID = "group_id" TableUserGroupsColumnUpdatedAt = "updated_at" TableUserGroupsColumnUpdatedBy = "updated_by" TableUserGroupsColumnUserID = "user_id" TableUserGroupsConstraintCreatedByForeignKey = "charon.user_groups_created_by_fkey" TableUserGroupsConstraintUpdatedByForeignKey = "charon.user_groups_updated_by_fkey" TableUserGroupsConstraintUserIDForeignKey = "charon.user_groups_user_id_fkey" TableUserGroupsConstraintGroupIDForeignKey = "charon.user_groups_group_id_fkey" TableUserGroupsConstraintUserIDGroupIDUnique = "charon.user_groups_user_id_group_id_key" )
const ( TableGroupPermissions = "charon.group_permissions" TableGroupPermissionsColumnCreatedAt = "created_at" TableGroupPermissionsColumnCreatedBy = "created_by" TableGroupPermissionsColumnGroupID = "group_id" TableGroupPermissionsColumnPermissionAction = "permission_action" TableGroupPermissionsColumnPermissionModule = "permission_module" TableGroupPermissionsColumnPermissionSubsystem = "permission_subsystem" TableGroupPermissionsColumnUpdatedAt = "updated_at" TableGroupPermissionsColumnUpdatedBy = "updated_by" TableGroupPermissionsConstraintCreatedByForeignKey = "charon.group_permissions_created_by_fkey" TableGroupPermissionsConstraintUpdatedByForeignKey = "charon.group_permissions_updated_by_fkey" TableGroupPermissionsConstraintGroupIDForeignKey = "charon.group_permissions_group_id_fkey" TableGroupPermissionsConstraintPermissionSubsystemPermissionModulePermissionActionForeignKey = "charon.group_permissions_subsystem_module_action_fkey" TableGroupPermissionsConstraintGroupIDPermissionSubsystemPermissionModulePermissionActionUnique = "charon.group_permissions_group_id_subsystem_module_action_key" )
const ( TableUserPermissions = "charon.user_permissions" TableUserPermissionsColumnCreatedAt = "created_at" TableUserPermissionsColumnCreatedBy = "created_by" TableUserPermissionsColumnPermissionAction = "permission_action" TableUserPermissionsColumnPermissionModule = "permission_module" TableUserPermissionsColumnPermissionSubsystem = "permission_subsystem" TableUserPermissionsColumnUpdatedAt = "updated_at" TableUserPermissionsColumnUpdatedBy = "updated_by" TableUserPermissionsColumnUserID = "user_id" TableUserPermissionsConstraintCreatedByForeignKey = "charon.user_permissions_created_by_fkey" TableUserPermissionsConstraintUpdatedByForeignKey = "charon.user_permissions_updated_by_fkey" TableUserPermissionsConstraintUserIDForeignKey = "charon.user_permissions_user_id_fkey" TableUserPermissionsConstraintPermissionSubsystemPermissionModulePermissionActionForeignKey = "charon.user_permissions_subsystem_module_action_fkey" TableUserPermissionsConstraintUserIDPermissionSubsystemPermissionModulePermissionActionUnique = "charon.user_permissions_user_id_subsystem_module_action_key" )
const SQL = `` /* 4404-byte string literal not displayed */
const (
// UserConfirmationTokenUsed ...
UserConfirmationTokenUsed = "!"
)
Variables ¶
var ( // ExternalPassword is a password that is set when external source of authentication is provided (e.g. LDAP). ExternalPassword = []byte("!") )
var ( TableGroupColumns = []string{ TableGroupColumnCreatedAt, TableGroupColumnCreatedBy, TableGroupColumnDescription, TableGroupColumnID, TableGroupColumnName, TableGroupColumnUpdatedAt, TableGroupColumnUpdatedBy, } )
var ( TableGroupPermissionsColumns = []string{ TableGroupPermissionsColumnCreatedAt, TableGroupPermissionsColumnCreatedBy, TableGroupPermissionsColumnGroupID, TableGroupPermissionsColumnPermissionAction, TableGroupPermissionsColumnPermissionModule, TableGroupPermissionsColumnPermissionSubsystem, TableGroupPermissionsColumnUpdatedAt, TableGroupPermissionsColumnUpdatedBy, } )
var ( TablePermissionColumns = []string{ TablePermissionColumnAction, TablePermissionColumnCreatedAt, TablePermissionColumnID, TablePermissionColumnModule, TablePermissionColumnSubsystem, TablePermissionColumnUpdatedAt, } )
var ( TableUserColumns = []string{ TableUserColumnConfirmationToken, TableUserColumnCreatedAt, TableUserColumnCreatedBy, TableUserColumnFirstName, TableUserColumnID, TableUserColumnIsActive, TableUserColumnIsConfirmed, TableUserColumnIsStaff, TableUserColumnIsSuperuser, TableUserColumnLastLoginAt, TableUserColumnLastName, TableUserColumnPassword, TableUserColumnUpdatedAt, TableUserColumnUpdatedBy, TableUserColumnUsername, } )
var ( TableUserGroupsColumns = []string{ TableUserGroupsColumnCreatedAt, TableUserGroupsColumnCreatedBy, TableUserGroupsColumnGroupID, TableUserGroupsColumnUpdatedAt, TableUserGroupsColumnUpdatedBy, TableUserGroupsColumnUserID, } )
var ( TableUserPermissionsColumns = []string{ TableUserPermissionsColumnCreatedAt, TableUserPermissionsColumnCreatedBy, TableUserPermissionsColumnPermissionAction, TableUserPermissionsColumnPermissionModule, TableUserPermissionsColumnPermissionSubsystem, TableUserPermissionsColumnUpdatedAt, TableUserPermissionsColumnUpdatedBy, TableUserPermissionsColumnUserID, } )
Functions ¶
This section is empty.
Types ¶
type GroupCriteria ¶
type GroupCriteria struct {
Offset, Limit int64
Sort map[string]bool
CreatedAt *qtypes.Timestamp
CreatedBy *qtypes.Int64
Description *qtypes.String
ID *qtypes.Int64
Name *qtypes.String
UpdatedAt *qtypes.Timestamp
UpdatedBy *qtypes.Int64
}
func (*GroupCriteria) WriteComposition ¶
func (c *GroupCriteria) WriteComposition(sel string, com *pqtgo.Composer, opt *pqtgo.CompositionOpts) (err error)
type GroupEntity ¶
type GroupEntity struct { // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy *ntypes.Int64 // Description ... Description *ntypes.String // ID ... ID int64 // Name ... Name string // UpdatedAt ... UpdatedAt *time.Time // UpdatedBy ... UpdatedBy *ntypes.Int64 // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity // Permissions ... Permissions []*PermissionEntity // Users ... Users []*UserEntity }
func ScanGroupRows ¶
func ScanGroupRows(rows *sql.Rows) ([]*GroupEntity, error)
func (*GroupEntity) Message ¶
func (ge *GroupEntity) Message() (*charonrpc.Group, error)
Message maps entity into protobuf message.
func (*GroupEntity) Prop ¶
func (e *GroupEntity) Prop(cn string) (interface{}, bool)
func (*GroupEntity) Props ¶
func (e *GroupEntity) Props(cns ...string) ([]interface{}, error)
type GroupIterator ¶
type GroupIterator struct {
// contains filtered or unexported fields
}
GroupIterator is not thread safe.
func (*GroupIterator) Close ¶
func (i *GroupIterator) Close() error
func (*GroupIterator) Columns ¶
func (i *GroupIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache outpu inside iterator.
func (*GroupIterator) Ent ¶
func (i *GroupIterator) Ent() (interface{}, error)
Ent is wrapper around Group method that makes iterator more generic.
func (*GroupIterator) Err ¶
func (i *GroupIterator) Err() error
func (*GroupIterator) Group ¶
func (i *GroupIterator) Group() (*GroupEntity, error)
func (*GroupIterator) Next ¶
func (i *GroupIterator) Next() bool
type GroupPatch ¶
type GroupPermissionsCriteria ¶
type GroupPermissionsCriteria struct {
Offset, Limit int64
Sort map[string]bool
CreatedAt *qtypes.Timestamp
CreatedBy *qtypes.Int64
GroupID *qtypes.Int64
PermissionAction *qtypes.String
PermissionModule *qtypes.String
PermissionSubsystem *qtypes.String
UpdatedAt *qtypes.Timestamp
UpdatedBy *qtypes.Int64
}
func (*GroupPermissionsCriteria) WriteComposition ¶
func (c *GroupPermissionsCriteria) WriteComposition(sel string, com *pqtgo.Composer, opt *pqtgo.CompositionOpts) (err error)
type GroupPermissionsEntity ¶
type GroupPermissionsEntity struct { // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy *ntypes.Int64 // GroupID ... GroupID int64 // PermissionAction ... PermissionAction string // PermissionModule ... PermissionModule string // PermissionSubsystem ... PermissionSubsystem string // UpdatedAt ... UpdatedAt *time.Time // UpdatedBy ... UpdatedBy *ntypes.Int64 // Group ... Group *GroupEntity // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity }
func ScanGroupPermissionsRows ¶
func ScanGroupPermissionsRows(rows *sql.Rows) ([]*GroupPermissionsEntity, error)
func (*GroupPermissionsEntity) Prop ¶
func (e *GroupPermissionsEntity) Prop(cn string) (interface{}, bool)
func (*GroupPermissionsEntity) Props ¶
func (e *GroupPermissionsEntity) Props(cns ...string) ([]interface{}, error)
type GroupPermissionsIterator ¶
type GroupPermissionsIterator struct {
// contains filtered or unexported fields
}
GroupPermissionsIterator is not thread safe.
func (*GroupPermissionsIterator) Close ¶
func (i *GroupPermissionsIterator) Close() error
func (*GroupPermissionsIterator) Columns ¶
func (i *GroupPermissionsIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache outpu inside iterator.
func (*GroupPermissionsIterator) Ent ¶
func (i *GroupPermissionsIterator) Ent() (interface{}, error)
Ent is wrapper around GroupPermissions method that makes iterator more generic.
func (*GroupPermissionsIterator) Err ¶
func (i *GroupPermissionsIterator) Err() error
func (*GroupPermissionsIterator) GroupPermissions ¶
func (i *GroupPermissionsIterator) GroupPermissions() (*GroupPermissionsEntity, error)
func (*GroupPermissionsIterator) Next ¶
func (i *GroupPermissionsIterator) Next() bool
type GroupPermissionsPatch ¶
type GroupPermissionsProvider ¶
type GroupPermissionsProvider interface {
Insert(entity *GroupPermissionsEntity) (*GroupPermissionsEntity, error)
}
GroupPermissionsProvider ...
func NewGroupPermissionsRepository ¶
func NewGroupPermissionsRepository(dbPool *sql.DB) GroupPermissionsProvider
NewGroupPermissionsRepository ...
type GroupPermissionsRepository ¶
type GroupPermissionsRepository struct {
GroupPermissionsRepositoryBase
}
GroupPermissionsRepository extends GroupPermissionsRepositoryBase
type GroupPermissionsRepositoryBase ¶
type GroupPermissionsRepositoryBase struct {
// contains filtered or unexported fields
}
func (*GroupPermissionsRepositoryBase) Count ¶
func (r *GroupPermissionsRepositoryBase) Count(c *GroupPermissionsCriteria) (int64, error)
func (*GroupPermissionsRepositoryBase) Find ¶
func (r *GroupPermissionsRepositoryBase) Find(c *GroupPermissionsCriteria) ([]*GroupPermissionsEntity, error)
func (*GroupPermissionsRepositoryBase) FindIter ¶
func (r *GroupPermissionsRepositoryBase) FindIter(c *GroupPermissionsCriteria) (*GroupPermissionsIterator, error)
func (*GroupPermissionsRepositoryBase) FindOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction ¶
func (r *GroupPermissionsRepositoryBase) FindOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(groupPermissionsGroupID int64, groupPermissionsPermissionSubsystem string, groupPermissionsPermissionModule string, groupPermissionsPermissionAction string) (*GroupPermissionsEntity, error)
func (*GroupPermissionsRepositoryBase) Insert ¶
func (r *GroupPermissionsRepositoryBase) Insert(e *GroupPermissionsEntity) (*GroupPermissionsEntity, error)
func (*GroupPermissionsRepositoryBase) UpdateOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction ¶
func (r *GroupPermissionsRepositoryBase) UpdateOneByGroupIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(groupPermissionsGroupID int64, groupPermissionsPermissionSubsystem string, groupPermissionsPermissionModule string, groupPermissionsPermissionAction string, patch *GroupPermissionsPatch) (*GroupPermissionsEntity, error)
func (*GroupPermissionsRepositoryBase) Upsert ¶
func (r *GroupPermissionsRepositoryBase) Upsert(e *GroupPermissionsEntity, p *GroupPermissionsPatch, inf ...string) (*GroupPermissionsEntity, error)
type GroupProvider ¶
type GroupProvider interface { Insert(entity *GroupEntity) (*GroupEntity, error) // FindByUserID retrieves all groups for user represented by given id. FindByUserID(int64) ([]*GroupEntity, error) // FindOneByID retrieves group for given id. FindOneByID(int64) (*GroupEntity, error) // find ... Find(c *GroupCriteria) ([]*GroupEntity, error) // Create ... Create(createdBy int64, name string, description *ntypes.String) (*GroupEntity, error) // updateOneByID ... UpdateOneByID(id, updatedBy int64, name, description *ntypes.String) (*GroupEntity, error) // DeleteByID ... DeleteOneByID(id int64) (int64, error) // IsGranted ... IsGranted(id int64, permission charon.Permission) (bool, error) // SetPermissions ... SetPermissions(id int64, permissions ...charon.Permission) (int64, int64, error) }
GroupProvider ...
func NewGroupRepository ¶
func NewGroupRepository(dbPool *sql.DB) GroupProvider
NewGroupRepository ...
type GroupRepository ¶
type GroupRepository struct {
GroupRepositoryBase
}
GroupRepository extens GroupRepositoryBase
func (*GroupRepository) Create ¶
func (gr *GroupRepository) Create(createdBy int64, name string, description *ntypes.String) (ent *GroupEntity, err error)
Create ...
func (*GroupRepository) FindByUserID ¶
func (gr *GroupRepository) FindByUserID(userID int64) ([]*GroupEntity, error)
FindByUserID implements GroupProvider interface.
func (*GroupRepository) IsGranted ¶
func (gr *GroupRepository) IsGranted(id int64, p charon.Permission) (bool, error)
IsGranted ...
func (*GroupRepository) SetPermissions ¶
func (gr *GroupRepository) SetPermissions(id int64, p ...charon.Permission) (int64, int64, error)
SetPermissions ...
func (*GroupRepository) UpdateOneByID ¶
func (gr *GroupRepository) UpdateOneByID(id, updatedBy int64, name, description *ntypes.String) (*GroupEntity, error)
UpdateOneByID ...
type GroupRepositoryBase ¶
type GroupRepositoryBase struct {
// contains filtered or unexported fields
}
func (*GroupRepositoryBase) Count ¶
func (r *GroupRepositoryBase) Count(c *GroupCriteria) (int64, error)
func (*GroupRepositoryBase) DeleteOneByID ¶
func (r *GroupRepositoryBase) DeleteOneByID(id int64) (int64, error)
func (*GroupRepositoryBase) Find ¶
func (r *GroupRepositoryBase) Find(c *GroupCriteria) ([]*GroupEntity, error)
func (*GroupRepositoryBase) FindIter ¶
func (r *GroupRepositoryBase) FindIter(c *GroupCriteria) (*GroupIterator, error)
func (*GroupRepositoryBase) FindOneByID ¶
func (r *GroupRepositoryBase) FindOneByID(id int64) (*GroupEntity, error)
func (*GroupRepositoryBase) FindOneByName ¶
func (r *GroupRepositoryBase) FindOneByName(groupName string) (*GroupEntity, error)
func (*GroupRepositoryBase) Insert ¶
func (r *GroupRepositoryBase) Insert(e *GroupEntity) (*GroupEntity, error)
func (*GroupRepositoryBase) UpdateOneByID ¶
func (r *GroupRepositoryBase) UpdateOneByID(id int64, patch *GroupPatch) (*GroupEntity, error)
func (*GroupRepositoryBase) UpdateOneByName ¶
func (r *GroupRepositoryBase) UpdateOneByName(groupName string, patch *GroupPatch) (*GroupEntity, error)
func (*GroupRepositoryBase) Upsert ¶
func (r *GroupRepositoryBase) Upsert(e *GroupEntity, p *GroupPatch, inf ...string) (*GroupEntity, error)
type MockGroupPermissionsProvider ¶
func (*MockGroupPermissionsProvider) Insert ¶
func (_m *MockGroupPermissionsProvider) Insert(entity *GroupPermissionsEntity) (*GroupPermissionsEntity, error)
Insert provides a mock function with given fields: entity
type MockGroupProvider ¶
func (*MockGroupProvider) Create ¶
func (_m *MockGroupProvider) Create(createdBy int64, name string, description *ntypes.String) (*GroupEntity, error)
Create provides a mock function with given fields: createdBy, name, description
func (*MockGroupProvider) DeleteOneByID ¶
func (_m *MockGroupProvider) DeleteOneByID(id int64) (int64, error)
DeleteOneByID provides a mock function with given fields: id
func (*MockGroupProvider) Find ¶
func (_m *MockGroupProvider) Find(c *GroupCriteria) ([]*GroupEntity, error)
Find provides a mock function with given fields: c
func (*MockGroupProvider) FindByUserID ¶
func (_m *MockGroupProvider) FindByUserID(_a0 int64) ([]*GroupEntity, error)
FindByUserID provides a mock function with given fields: _a0
func (*MockGroupProvider) FindOneByID ¶
func (_m *MockGroupProvider) FindOneByID(_a0 int64) (*GroupEntity, error)
FindOneByID provides a mock function with given fields: _a0
func (*MockGroupProvider) Insert ¶
func (_m *MockGroupProvider) Insert(entity *GroupEntity) (*GroupEntity, error)
Insert provides a mock function with given fields: entity
func (*MockGroupProvider) IsGranted ¶
func (_m *MockGroupProvider) IsGranted(id int64, permission charon.Permission) (bool, error)
IsGranted provides a mock function with given fields: id, permission
func (*MockGroupProvider) SetPermissions ¶
func (_m *MockGroupProvider) SetPermissions(id int64, permissions ...charon.Permission) (int64, int64, error)
SetPermissions provides a mock function with given fields: id, permissions
func (*MockGroupProvider) UpdateOneByID ¶
func (_m *MockGroupProvider) UpdateOneByID(id int64, updatedBy int64, name *ntypes.String, description *ntypes.String) (*GroupEntity, error)
UpdateOneByID provides a mock function with given fields: id, updatedBy, name, description
type MockPermissionProvider ¶
func (*MockPermissionProvider) Find ¶
func (_m *MockPermissionProvider) Find(criteria *PermissionCriteria) ([]*PermissionEntity, error)
Find provides a mock function with given fields: criteria
func (*MockPermissionProvider) FindByGroupID ¶
func (_m *MockPermissionProvider) FindByGroupID(groupID int64) ([]*PermissionEntity, error)
FindByGroupID provides a mock function with given fields: groupID
func (*MockPermissionProvider) FindByUserID ¶
func (_m *MockPermissionProvider) FindByUserID(userID int64) ([]*PermissionEntity, error)
FindByUserID provides a mock function with given fields: userID
func (*MockPermissionProvider) FindOneByID ¶
func (_m *MockPermissionProvider) FindOneByID(id int64) (*PermissionEntity, error)
FindOneByID provides a mock function with given fields: id
func (*MockPermissionProvider) Insert ¶
func (_m *MockPermissionProvider) Insert(entity *PermissionEntity) (*PermissionEntity, error)
Insert provides a mock function with given fields: entity
func (*MockPermissionProvider) Register ¶
func (_m *MockPermissionProvider) Register(permissions charon.Permissions) (int64, int64, int64, error)
Register provides a mock function with given fields: permissions
type MockPermissionRegistry ¶
func (*MockPermissionRegistry) Exists ¶
func (_m *MockPermissionRegistry) Exists(permission charon.Permission) bool
Exists provides a mock function with given fields: permission
func (*MockPermissionRegistry) Register ¶
func (_m *MockPermissionRegistry) Register(permissions charon.Permissions) (int64, int64, int64, error)
Register provides a mock function with given fields: permissions
type MockUserGroupsProvider ¶
func (*MockUserGroupsProvider) DeleteByUserID ¶ added in v0.8.4
func (_m *MockUserGroupsProvider) DeleteByUserID(id int64) (int64, error)
DeleteByUserID provides a mock function with given fields: id
func (*MockUserGroupsProvider) Exists ¶
func (_m *MockUserGroupsProvider) Exists(userID int64, groupID int64) (bool, error)
Exists provides a mock function with given fields: userID, groupID
func (*MockUserGroupsProvider) Find ¶
func (_m *MockUserGroupsProvider) Find(criteria *UserGroupsCriteria) ([]*UserGroupsEntity, error)
Find provides a mock function with given fields: criteria
func (*MockUserGroupsProvider) Insert ¶
func (_m *MockUserGroupsProvider) Insert(entity *UserGroupsEntity) (*UserGroupsEntity, error)
Insert provides a mock function with given fields: entity
type MockUserPermissionsProvider ¶
func (*MockUserPermissionsProvider) DeleteByUserID ¶ added in v0.8.4
func (_m *MockUserPermissionsProvider) DeleteByUserID(id int64) (int64, error)
DeleteByUserID provides a mock function with given fields: id
func (*MockUserPermissionsProvider) Insert ¶
func (_m *MockUserPermissionsProvider) Insert(entity *UserPermissionsEntity) (*UserPermissionsEntity, error)
Insert provides a mock function with given fields: entity
type MockUserProvider ¶
func (*MockUserProvider) ChangePassword ¶
func (_m *MockUserProvider) ChangePassword(id int64, password string) error
ChangePassword provides a mock function with given fields: id, password
func (*MockUserProvider) Count ¶
func (_m *MockUserProvider) Count() (int64, error)
Count provides a mock function with given fields:
func (*MockUserProvider) Create ¶
func (_m *MockUserProvider) Create(username string, password []byte, FirstName string, LastName string, confirmationToken []byte, isSuperuser bool, IsStaff bool, isActive bool, isConfirmed bool) (*UserEntity, error)
Create provides a mock function with given fields: username, password, FirstName, LastName, confirmationToken, isSuperuser, IsStaff, isActive, isConfirmed
func (*MockUserProvider) CreateSuperuser ¶
func (_m *MockUserProvider) CreateSuperuser(username string, password []byte, FirstName string, LastName string) (*UserEntity, error)
CreateSuperuser provides a mock function with given fields: username, password, FirstName, LastName
func (*MockUserProvider) DeleteOneByID ¶
func (_m *MockUserProvider) DeleteOneByID(id int64) (int64, error)
DeleteOneByID provides a mock function with given fields: id
func (*MockUserProvider) Exists ¶
func (_m *MockUserProvider) Exists(id int64) (bool, error)
Exists provides a mock function with given fields: id
func (*MockUserProvider) Find ¶
func (_m *MockUserProvider) Find(criteria *UserCriteria) ([]*UserEntity, error)
Find provides a mock function with given fields: criteria
func (*MockUserProvider) FindOneByID ¶
func (_m *MockUserProvider) FindOneByID(id int64) (*UserEntity, error)
FindOneByID provides a mock function with given fields: id
func (*MockUserProvider) FindOneByUsername ¶
func (_m *MockUserProvider) FindOneByUsername(username string) (*UserEntity, error)
FindOneByUsername provides a mock function with given fields: username
func (*MockUserProvider) Insert ¶
func (_m *MockUserProvider) Insert(_a0 *UserEntity) (*UserEntity, error)
Insert provides a mock function with given fields: _a0
func (*MockUserProvider) IsGranted ¶
func (_m *MockUserProvider) IsGranted(id int64, permission charon.Permission) (bool, error)
IsGranted provides a mock function with given fields: id, permission
func (*MockUserProvider) RegistrationConfirmation ¶
func (_m *MockUserProvider) RegistrationConfirmation(id int64, confirmationToken string) error
RegistrationConfirmation provides a mock function with given fields: id, confirmationToken
func (*MockUserProvider) SetPermissions ¶
func (_m *MockUserProvider) SetPermissions(id int64, permissions ...charon.Permission) (int64, int64, error)
SetPermissions provides a mock function with given fields: id, permissions
func (*MockUserProvider) UpdateLastLoginAt ¶
func (_m *MockUserProvider) UpdateLastLoginAt(id int64) (int64, error)
UpdateLastLoginAt provides a mock function with given fields: id
func (*MockUserProvider) UpdateOneByID ¶
func (_m *MockUserProvider) UpdateOneByID(_a0 int64, _a1 *UserPatch) (*UserEntity, error)
UpdateOneByID provides a mock function with given fields: _a0, _a1
type PermissionCriteria ¶
type PermissionCriteria struct {
Offset, Limit int64
Sort map[string]bool
Action *qtypes.String
CreatedAt *qtypes.Timestamp
ID *qtypes.Int64
Module *qtypes.String
Subsystem *qtypes.String
UpdatedAt *qtypes.Timestamp
}
func (*PermissionCriteria) WriteComposition ¶
func (c *PermissionCriteria) WriteComposition(sel string, com *pqtgo.Composer, opt *pqtgo.CompositionOpts) (err error)
type PermissionEntity ¶
type PermissionEntity struct { // Action ... Action string // CreatedAt ... CreatedAt time.Time // ID ... ID int64 // Module ... Module string // Subsystem ... Subsystem string // UpdatedAt ... UpdatedAt *time.Time // Groups ... Groups []*GroupEntity // Users ... Users []*UserEntity }
func ScanPermissionRows ¶
func ScanPermissionRows(rows *sql.Rows) ([]*PermissionEntity, error)
func (*PermissionEntity) Permission ¶
func (pe *PermissionEntity) Permission() charon.Permission
Permission returns charon.Permission value that is concatenated using entity properties like subsystem, module and action.
func (*PermissionEntity) Prop ¶
func (e *PermissionEntity) Prop(cn string) (interface{}, bool)
func (*PermissionEntity) Props ¶
func (e *PermissionEntity) Props(cns ...string) ([]interface{}, error)
type PermissionIterator ¶
type PermissionIterator struct {
// contains filtered or unexported fields
}
PermissionIterator is not thread safe.
func (*PermissionIterator) Close ¶
func (i *PermissionIterator) Close() error
func (*PermissionIterator) Columns ¶
func (i *PermissionIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache outpu inside iterator.
func (*PermissionIterator) Ent ¶
func (i *PermissionIterator) Ent() (interface{}, error)
Ent is wrapper around Permission method that makes iterator more generic.
func (*PermissionIterator) Err ¶
func (i *PermissionIterator) Err() error
func (*PermissionIterator) Next ¶
func (i *PermissionIterator) Next() bool
func (*PermissionIterator) Permission ¶
func (i *PermissionIterator) Permission() (*PermissionEntity, error)
type PermissionPatch ¶
type PermissionProvider ¶
type PermissionProvider interface { Find(criteria *PermissionCriteria) ([]*PermissionEntity, error) FindOneByID(id int64) (entity *PermissionEntity, err error) // FindByUserID retrieves all permissions for user represented by given id. FindByUserID(userID int64) (entities []*PermissionEntity, err error) // FindByGroupID retrieves all permissions for group represented by given id. FindByGroupID(groupID int64) (entities []*PermissionEntity, err error) Register(permissions charon.Permissions) (created, untouched, removed int64, err error) Insert(entity *PermissionEntity) (*PermissionEntity, error) }
PermissionProvider ...
type PermissionReg ¶
PermissionReg ...
func NewPermissionRegistry ¶
func NewPermissionRegistry(r PermissionProvider) *PermissionReg
NewPermissionRegistry ...
func (*PermissionReg) Exists ¶
func (pr *PermissionReg) Exists(permission charon.Permission) (ok bool)
Exists ...
func (*PermissionReg) Register ¶
func (pr *PermissionReg) Register(permissions charon.Permissions) (created, untouched, removed int64, err error)
Register ...
type PermissionRegistry ¶
type PermissionRegistry interface { // Exists returns true if given charon.Permission was already registered. Exists(permission charon.Permission) (exists bool) // Register checks if given collection is valid and // calls PermissionProvider to store provided permissions // in persistent way. Register(permissions charon.Permissions) (created, untouched, removed int64, err error) }
PermissionRegistry is an interface that describes in memory storage that holds information about permissions that was registered by 3rd party services. Should be only used as a proxy for registration process to avoid multiple sql hits.
type PermissionRepository ¶
type PermissionRepository struct { PermissionRepositoryBase // contains filtered or unexported fields }
PermissionRepository extends PermissionRepositoryBase
func NewPermissionRepository ¶
func NewPermissionRepository(dbPool *sql.DB) *PermissionRepository
NewPermissionRepository ...
func (*PermissionRepository) FindBy ¶
func (pr *PermissionRepository) FindBy(query string, args ...interface{}) ([]*PermissionEntity, error)
FindBy ...
func (*PermissionRepository) FindByGroupID ¶
func (pr *PermissionRepository) FindByGroupID(userID int64) ([]*PermissionEntity, error)
FindByGroupID implements PermissionProvider interface.
func (*PermissionRepository) FindByTag ¶
func (pr *PermissionRepository) FindByTag(userID int64) ([]*PermissionEntity, error)
FindByTag ...
func (*PermissionRepository) FindByUserID ¶
func (pr *PermissionRepository) FindByUserID(userID int64) ([]*PermissionEntity, error)
FindByUserID implements PermissionProvider interface.
func (*PermissionRepository) Register ¶
func (pr *PermissionRepository) Register(permissions charon.Permissions) (created, unt, removed int64, err error)
Register ...
type PermissionRepositoryBase ¶
type PermissionRepositoryBase struct {
// contains filtered or unexported fields
}
func (*PermissionRepositoryBase) Count ¶
func (r *PermissionRepositoryBase) Count(c *PermissionCriteria) (int64, error)
func (*PermissionRepositoryBase) DeleteOneByID ¶
func (r *PermissionRepositoryBase) DeleteOneByID(id int64) (int64, error)
func (*PermissionRepositoryBase) Find ¶
func (r *PermissionRepositoryBase) Find(c *PermissionCriteria) ([]*PermissionEntity, error)
func (*PermissionRepositoryBase) FindIter ¶
func (r *PermissionRepositoryBase) FindIter(c *PermissionCriteria) (*PermissionIterator, error)
func (*PermissionRepositoryBase) FindOneByID ¶
func (r *PermissionRepositoryBase) FindOneByID(id int64) (*PermissionEntity, error)
func (*PermissionRepositoryBase) FindOneBySubsystemAndModuleAndAction ¶
func (r *PermissionRepositoryBase) FindOneBySubsystemAndModuleAndAction(permissionSubsystem string, permissionModule string, permissionAction string) (*PermissionEntity, error)
func (*PermissionRepositoryBase) Insert ¶
func (r *PermissionRepositoryBase) Insert(e *PermissionEntity) (*PermissionEntity, error)
func (*PermissionRepositoryBase) UpdateOneByID ¶
func (r *PermissionRepositoryBase) UpdateOneByID(id int64, patch *PermissionPatch) (*PermissionEntity, error)
func (*PermissionRepositoryBase) UpdateOneBySubsystemAndModuleAndAction ¶
func (r *PermissionRepositoryBase) UpdateOneBySubsystemAndModuleAndAction(permissionSubsystem string, permissionModule string, permissionAction string, patch *PermissionPatch) (*PermissionEntity, error)
func (*PermissionRepositoryBase) Upsert ¶
func (r *PermissionRepositoryBase) Upsert(e *PermissionEntity, p *PermissionPatch, inf ...string) (*PermissionEntity, error)
type UserCriteria ¶
type UserCriteria struct {
Offset, Limit int64
Sort map[string]bool
ConfirmationToken []byte
CreatedAt *qtypes.Timestamp
CreatedBy *qtypes.Int64
FirstName *qtypes.String
ID *qtypes.Int64
IsActive *ntypes.Bool
IsConfirmed *ntypes.Bool
IsStaff *ntypes.Bool
IsSuperuser *ntypes.Bool
LastLoginAt *qtypes.Timestamp
LastName *qtypes.String
Password []byte
UpdatedAt *qtypes.Timestamp
UpdatedBy *qtypes.Int64
Username *qtypes.String
}
func (*UserCriteria) WriteComposition ¶
func (c *UserCriteria) WriteComposition(sel string, com *pqtgo.Composer, opt *pqtgo.CompositionOpts) (err error)
type UserEntity ¶
type UserEntity struct { // ConfirmationToken ... ConfirmationToken []byte // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy *ntypes.Int64 // FirstName ... FirstName string // ID ... ID int64 // IsActive ... IsActive bool // IsConfirmed ... IsConfirmed bool // IsStaff ... IsStaff bool // IsSuperuser ... IsSuperuser bool // LastLoginAt ... LastLoginAt *time.Time // LastName ... LastName string // Password ... Password []byte // UpdatedAt ... UpdatedAt *time.Time // UpdatedBy ... UpdatedBy *ntypes.Int64 // Username ... Username string // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity // Permissions ... Permissions []*PermissionEntity // Groups ... Groups []*GroupEntity }
func ScanUserRows ¶
func ScanUserRows(rows *sql.Rows) ([]*UserEntity, error)
func (*UserEntity) Message ¶
func (ue *UserEntity) Message() (*charonrpc.User, error)
Message maps entity into protobuf message.
func (*UserEntity) Prop ¶
func (e *UserEntity) Prop(cn string) (interface{}, bool)
func (*UserEntity) Props ¶
func (e *UserEntity) Props(cns ...string) ([]interface{}, error)
func (*UserEntity) String ¶
func (ue *UserEntity) String() string
String return concatenated first and last name of the user. Implements fmt Stringer interface.
type UserGroupsCriteria ¶
type UserGroupsCriteria struct {
Offset, Limit int64
Sort map[string]bool
CreatedAt *qtypes.Timestamp
CreatedBy *qtypes.Int64
GroupID *qtypes.Int64
UpdatedAt *qtypes.Timestamp
UpdatedBy *qtypes.Int64
UserID *qtypes.Int64
}
func (*UserGroupsCriteria) WriteComposition ¶
func (c *UserGroupsCriteria) WriteComposition(sel string, com *pqtgo.Composer, opt *pqtgo.CompositionOpts) (err error)
type UserGroupsEntity ¶
type UserGroupsEntity struct { // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy *ntypes.Int64 // GroupID ... GroupID int64 // UpdatedAt ... UpdatedAt *time.Time // UpdatedBy ... UpdatedBy *ntypes.Int64 // UserID ... UserID int64 // User ... User *UserEntity // Group ... Group *GroupEntity // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity }
func ScanUserGroupsRows ¶
func ScanUserGroupsRows(rows *sql.Rows) ([]*UserGroupsEntity, error)
func (*UserGroupsEntity) Prop ¶
func (e *UserGroupsEntity) Prop(cn string) (interface{}, bool)
func (*UserGroupsEntity) Props ¶
func (e *UserGroupsEntity) Props(cns ...string) ([]interface{}, error)
type UserGroupsIterator ¶
type UserGroupsIterator struct {
// contains filtered or unexported fields
}
UserGroupsIterator is not thread safe.
func (*UserGroupsIterator) Close ¶
func (i *UserGroupsIterator) Close() error
func (*UserGroupsIterator) Columns ¶
func (i *UserGroupsIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache outpu inside iterator.
func (*UserGroupsIterator) Ent ¶
func (i *UserGroupsIterator) Ent() (interface{}, error)
Ent is wrapper around UserGroups method that makes iterator more generic.
func (*UserGroupsIterator) Err ¶
func (i *UserGroupsIterator) Err() error
func (*UserGroupsIterator) Next ¶
func (i *UserGroupsIterator) Next() bool
func (*UserGroupsIterator) UserGroups ¶
func (i *UserGroupsIterator) UserGroups() (*UserGroupsEntity, error)
type UserGroupsPatch ¶
type UserGroupsProvider ¶
type UserGroupsProvider interface { Insert(entity *UserGroupsEntity) (*UserGroupsEntity, error) Exists(userID, groupID int64) (bool, error) Find(criteria *UserGroupsCriteria) ([]*UserGroupsEntity, error) Set(userID int64, groupIDs []int64) (int64, int64, error) DeleteByUserID(id int64) (int64, error) }
UserGroupsProvider ...
func NewUserGroupsRepository ¶
func NewUserGroupsRepository(dbPool *sql.DB) UserGroupsProvider
NewUserGroupsRepository ...
type UserGroupsRepository ¶
type UserGroupsRepository struct { UserGroupsRepositoryBase // contains filtered or unexported fields }
UserGroupsRepository ...
func (*UserGroupsRepository) DeleteByUserID ¶ added in v0.8.4
func (ugr *UserGroupsRepository) DeleteByUserID(id int64) (int64, error)
DeleteByUserID removes user from all groups he belongs to.
type UserGroupsRepositoryBase ¶
type UserGroupsRepositoryBase struct {
// contains filtered or unexported fields
}
func (*UserGroupsRepositoryBase) Count ¶
func (r *UserGroupsRepositoryBase) Count(c *UserGroupsCriteria) (int64, error)
func (*UserGroupsRepositoryBase) Find ¶
func (r *UserGroupsRepositoryBase) Find(c *UserGroupsCriteria) ([]*UserGroupsEntity, error)
func (*UserGroupsRepositoryBase) FindIter ¶
func (r *UserGroupsRepositoryBase) FindIter(c *UserGroupsCriteria) (*UserGroupsIterator, error)
func (*UserGroupsRepositoryBase) FindOneByUserIDAndGroupID ¶
func (r *UserGroupsRepositoryBase) FindOneByUserIDAndGroupID(userGroupsUserID int64, userGroupsGroupID int64) (*UserGroupsEntity, error)
func (*UserGroupsRepositoryBase) Insert ¶
func (r *UserGroupsRepositoryBase) Insert(e *UserGroupsEntity) (*UserGroupsEntity, error)
func (*UserGroupsRepositoryBase) UpdateOneByUserIDAndGroupID ¶
func (r *UserGroupsRepositoryBase) UpdateOneByUserIDAndGroupID(userGroupsUserID int64, userGroupsGroupID int64, patch *UserGroupsPatch) (*UserGroupsEntity, error)
func (*UserGroupsRepositoryBase) Upsert ¶
func (r *UserGroupsRepositoryBase) Upsert(e *UserGroupsEntity, p *UserGroupsPatch, inf ...string) (*UserGroupsEntity, error)
type UserIterator ¶
type UserIterator struct {
// contains filtered or unexported fields
}
UserIterator is not thread safe.
func (*UserIterator) Close ¶
func (i *UserIterator) Close() error
func (*UserIterator) Columns ¶
func (i *UserIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache outpu inside iterator.
func (*UserIterator) Ent ¶
func (i *UserIterator) Ent() (interface{}, error)
Ent is wrapper around User method that makes iterator more generic.
func (*UserIterator) Err ¶
func (i *UserIterator) Err() error
func (*UserIterator) Next ¶
func (i *UserIterator) Next() bool
func (*UserIterator) User ¶
func (i *UserIterator) User() (*UserEntity, error)
type UserPatch ¶
type UserPatch struct { ConfirmationToken []byte CreatedAt *time.Time CreatedBy *ntypes.Int64 FirstName *ntypes.String IsActive *ntypes.Bool IsConfirmed *ntypes.Bool IsStaff *ntypes.Bool IsSuperuser *ntypes.Bool LastLoginAt *time.Time LastName *ntypes.String Password []byte UpdatedAt *time.Time UpdatedBy *ntypes.Int64 Username *ntypes.String }
type UserPermissionsCriteria ¶
type UserPermissionsCriteria struct {
Offset, Limit int64
Sort map[string]bool
CreatedAt *qtypes.Timestamp
CreatedBy *qtypes.Int64
PermissionAction *qtypes.String
PermissionModule *qtypes.String
PermissionSubsystem *qtypes.String
UpdatedAt *qtypes.Timestamp
UpdatedBy *qtypes.Int64
UserID *qtypes.Int64
}
func (*UserPermissionsCriteria) WriteComposition ¶
func (c *UserPermissionsCriteria) WriteComposition(sel string, com *pqtgo.Composer, opt *pqtgo.CompositionOpts) (err error)
type UserPermissionsEntity ¶
type UserPermissionsEntity struct { // CreatedAt ... CreatedAt time.Time // CreatedBy ... CreatedBy *ntypes.Int64 // PermissionAction ... PermissionAction string // PermissionModule ... PermissionModule string // PermissionSubsystem ... PermissionSubsystem string // UpdatedAt ... UpdatedAt *time.Time // UpdatedBy ... UpdatedBy *ntypes.Int64 // UserID ... UserID int64 // User ... User *UserEntity // Author ... Author *UserEntity // Modifier ... Modifier *UserEntity }
func ScanUserPermissionsRows ¶
func ScanUserPermissionsRows(rows *sql.Rows) ([]*UserPermissionsEntity, error)
func (*UserPermissionsEntity) Prop ¶
func (e *UserPermissionsEntity) Prop(cn string) (interface{}, bool)
func (*UserPermissionsEntity) Props ¶
func (e *UserPermissionsEntity) Props(cns ...string) ([]interface{}, error)
type UserPermissionsIterator ¶
type UserPermissionsIterator struct {
// contains filtered or unexported fields
}
UserPermissionsIterator is not thread safe.
func (*UserPermissionsIterator) Close ¶
func (i *UserPermissionsIterator) Close() error
func (*UserPermissionsIterator) Columns ¶
func (i *UserPermissionsIterator) Columns() ([]string, error)
Columns is wrapper around sql.Rows.Columns method, that also cache outpu inside iterator.
func (*UserPermissionsIterator) Ent ¶
func (i *UserPermissionsIterator) Ent() (interface{}, error)
Ent is wrapper around UserPermissions method that makes iterator more generic.
func (*UserPermissionsIterator) Err ¶
func (i *UserPermissionsIterator) Err() error
func (*UserPermissionsIterator) Next ¶
func (i *UserPermissionsIterator) Next() bool
func (*UserPermissionsIterator) UserPermissions ¶
func (i *UserPermissionsIterator) UserPermissions() (*UserPermissionsEntity, error)
type UserPermissionsPatch ¶
type UserPermissionsProvider ¶
type UserPermissionsProvider interface { Insert(entity *UserPermissionsEntity) (*UserPermissionsEntity, error) DeleteByUserID(id int64) (int64, error) }
UserPermissionsProvider ...
func NewUserPermissionsRepository ¶
func NewUserPermissionsRepository(dbPool *sql.DB) UserPermissionsProvider
NewUserPermissionsRepository ...
type UserPermissionsRepository ¶
type UserPermissionsRepository struct { UserPermissionsRepositoryBase // contains filtered or unexported fields }
UserPermissionsRepository extends UserPermissionsRepositoryBase
func (*UserPermissionsRepository) DeleteByUserID ¶ added in v0.8.4
func (upr *UserPermissionsRepository) DeleteByUserID(id int64) (int64, error)
DeleteByUserID removes all permissions of given user.
type UserPermissionsRepositoryBase ¶
type UserPermissionsRepositoryBase struct {
// contains filtered or unexported fields
}
func (*UserPermissionsRepositoryBase) Count ¶
func (r *UserPermissionsRepositoryBase) Count(c *UserPermissionsCriteria) (int64, error)
func (*UserPermissionsRepositoryBase) Find ¶
func (r *UserPermissionsRepositoryBase) Find(c *UserPermissionsCriteria) ([]*UserPermissionsEntity, error)
func (*UserPermissionsRepositoryBase) FindIter ¶
func (r *UserPermissionsRepositoryBase) FindIter(c *UserPermissionsCriteria) (*UserPermissionsIterator, error)
func (*UserPermissionsRepositoryBase) FindOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction ¶
func (r *UserPermissionsRepositoryBase) FindOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(userPermissionsUserID int64, userPermissionsPermissionSubsystem string, userPermissionsPermissionModule string, userPermissionsPermissionAction string) (*UserPermissionsEntity, error)
func (*UserPermissionsRepositoryBase) Insert ¶
func (r *UserPermissionsRepositoryBase) Insert(e *UserPermissionsEntity) (*UserPermissionsEntity, error)
func (*UserPermissionsRepositoryBase) UpdateOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction ¶
func (r *UserPermissionsRepositoryBase) UpdateOneByUserIDAndPermissionSubsystemAndPermissionModuleAndPermissionAction(userPermissionsUserID int64, userPermissionsPermissionSubsystem string, userPermissionsPermissionModule string, userPermissionsPermissionAction string, patch *UserPermissionsPatch) (*UserPermissionsEntity, error)
func (*UserPermissionsRepositoryBase) Upsert ¶
func (r *UserPermissionsRepositoryBase) Upsert(e *UserPermissionsEntity, p *UserPermissionsPatch, inf ...string) (*UserPermissionsEntity, error)
type UserProvider ¶
type UserProvider interface { Exists(id int64) (bool, error) Create(username string, password []byte, FirstName, LastName string, confirmationToken []byte, isSuperuser, IsStaff, isActive, isConfirmed bool) (*UserEntity, error) Insert(*UserEntity) (*UserEntity, error) CreateSuperuser(username string, password []byte, FirstName, LastName string) (*UserEntity, error) // Count retrieves number of all users. Count() (int64, error) UpdateLastLoginAt(id int64) (int64, error) ChangePassword(id int64, password string) error Find(criteria *UserCriteria) ([]*UserEntity, error) FindOneByID(id int64) (*UserEntity, error) FindOneByUsername(username string) (*UserEntity, error) DeleteOneByID(id int64) (int64, error) UpdateOneByID(int64, *UserPatch) (*UserEntity, error) RegistrationConfirmation(id int64, confirmationToken string) error IsGranted(id int64, permission charon.Permission) (bool, error) SetPermissions(id int64, permissions ...charon.Permission) (int64, int64, error) }
UserProvider wraps UserRepository into interface.
type UserRepository ¶
type UserRepository struct {
UserRepositoryBase
}
UserRepository extends UserRepositoryBase.
func NewUserRepository ¶
func NewUserRepository(dbPool *sql.DB) *UserRepository
NewUserRepository alocates new UserRepository instance
func (*UserRepository) ChangePassword ¶
func (ur *UserRepository) ChangePassword(userID int64, password string) error
ChangePassword ...
func (*UserRepository) Count ¶
func (ur *UserRepository) Count() (n int64, err error)
Count implements UserProvider interface.
func (*UserRepository) Create ¶
func (ur *UserRepository) Create(username string, password []byte, firstName, lastName string, confirmationToken []byte, isSuperuser, isStaff, isActive, isConfirmed bool) (*UserEntity, error)
Create implements UserProvider interface.
func (*UserRepository) CreateSuperuser ¶
func (ur *UserRepository) CreateSuperuser(username string, password []byte, FirstName, LastName string) (*UserEntity, error)
CreateSuperuser implements UserProvider interface.
func (*UserRepository) Exists ¶
func (ur *UserRepository) Exists(userID int64) (bool, error)
Exists implements UserProvider interface.
func (*UserRepository) FindOneBy ¶
func (ur *UserRepository) FindOneBy(fieldName string, value interface{}) (*UserEntity, error)
FindOneBy ...
func (*UserRepository) FindOneByUsername ¶
func (ur *UserRepository) FindOneByUsername(username string) (*UserEntity, error)
FindOneByUsername ...
func (*UserRepository) IsGranted ¶
func (ur *UserRepository) IsGranted(id int64, p charon.Permission) (bool, error)
IsGranted implements UserProvider interface.
func (*UserRepository) RegistrationConfirmation ¶
func (ur *UserRepository) RegistrationConfirmation(userID int64, confirmationToken string) error
RegistrationConfirmation ...
func (*UserRepository) SetPermissions ¶
func (ur *UserRepository) SetPermissions(id int64, p ...charon.Permission) (int64, int64, error)
SetPermissions implements UserProvider interface.
func (*UserRepository) UpdateLastLoginAt ¶
func (ur *UserRepository) UpdateLastLoginAt(userID int64) (int64, error)
UpdateLastLoginAt implements UserProvider interface.
type UserRepositoryBase ¶
type UserRepositoryBase struct {
// contains filtered or unexported fields
}
func (*UserRepositoryBase) Count ¶
func (r *UserRepositoryBase) Count(c *UserCriteria) (int64, error)
func (*UserRepositoryBase) DeleteOneByID ¶
func (r *UserRepositoryBase) DeleteOneByID(id int64) (int64, error)
func (*UserRepositoryBase) Find ¶
func (r *UserRepositoryBase) Find(c *UserCriteria) ([]*UserEntity, error)
func (*UserRepositoryBase) FindIter ¶
func (r *UserRepositoryBase) FindIter(c *UserCriteria) (*UserIterator, error)
func (*UserRepositoryBase) FindOneByID ¶
func (r *UserRepositoryBase) FindOneByID(id int64) (*UserEntity, error)
func (*UserRepositoryBase) FindOneByUsername ¶
func (r *UserRepositoryBase) FindOneByUsername(userUsername string) (*UserEntity, error)
func (*UserRepositoryBase) Insert ¶
func (r *UserRepositoryBase) Insert(e *UserEntity) (*UserEntity, error)
func (*UserRepositoryBase) UpdateOneByID ¶
func (r *UserRepositoryBase) UpdateOneByID(id int64, patch *UserPatch) (*UserEntity, error)
func (*UserRepositoryBase) UpdateOneByUsername ¶
func (r *UserRepositoryBase) UpdateOneByUsername(userUsername string, patch *UserPatch) (*UserEntity, error)
func (*UserRepositoryBase) Upsert ¶
func (r *UserRepositoryBase) Upsert(e *UserEntity, p *UserPatch, inf ...string) (*UserEntity, error)