Documentation
¶
Index ¶
- type DataAdapter
- type Permission
- type PostgresAdapter
- func (a *PostgresAdapter) AddPermissionToRole(ctx context.Context, roleID, permissionID int64) error
- func (a *PostgresAdapter) AddRole(ctx context.Context, roleID int64, name string) error
- func (a *PostgresAdapter) AddRoleToUser(ctx context.Context, userID, roleID int64) error
- func (a *PostgresAdapter) AddUser(ctx context.Context, userID int64, ...) error
- func (a *PostgresAdapter) CreatePermission(ctx context.Context, name string) (int64, error)
- func (a *PostgresAdapter) GetPermissions(ctx context.Context) ([]Permission, error)
- func (a *PostgresAdapter) GetRolePermissions(ctx context.Context, roleID int64) ([]Permission, error)
- func (a *PostgresAdapter) GetRoles(ctx context.Context) ([]Role, error)
- func (a *PostgresAdapter) GetUser(ctx context.Context, userID int64) (User, error)
- func (a *PostgresAdapter) GetUserByEmail(ctx context.Context, email string) (User, error)
- func (a *PostgresAdapter) GetUserPermissions(ctx context.Context, userID int64) ([]Permission, error)
- func (a *PostgresAdapter) GetUserRoles(ctx context.Context, userID int64) ([]Role, error)
- func (a *PostgresAdapter) ProjectUser(ctx context.Context, userID int64, userState ubstate.UserState) error
- func (a *PostgresAdapter) ProjectUserRoles(ctx context.Context, userID int64, stateRoles []int64) error
- func (a *PostgresAdapter) RemoveAllRolesFromUser(ctx context.Context, userID int64) error
- func (a *PostgresAdapter) RemovePermissionFromRole(ctx context.Context, roleID, permissionID int64) error
- func (a *PostgresAdapter) UpdateRole(ctx context.Context, roleID int64, name string) error
- func (a *PostgresAdapter) UpdateUser(ctx context.Context, userID int64, ...) error
- type Role
- type SQLiteAdapter
- func (a *SQLiteAdapter) AddPermissionToRole(ctx context.Context, roleID, permissionID int64) error
- func (a *SQLiteAdapter) AddRole(ctx context.Context, roleID int64, name string) error
- func (a *SQLiteAdapter) AddRoleToUser(ctx context.Context, userID, roleID int64) error
- func (a *SQLiteAdapter) AddUser(ctx context.Context, userID int64, ...) error
- func (a *SQLiteAdapter) CreatePermission(ctx context.Context, name string) (int64, error)
- func (a *SQLiteAdapter) GetPermissions(ctx context.Context) ([]Permission, error)
- func (a *SQLiteAdapter) GetRolePermissions(ctx context.Context, roleID int64) ([]Permission, error)
- func (a *SQLiteAdapter) GetRoles(ctx context.Context) ([]Role, error)
- func (a *SQLiteAdapter) GetUser(ctx context.Context, userID int64) (User, error)
- func (a *SQLiteAdapter) GetUserByEmail(ctx context.Context, email string) (User, error)
- func (a *SQLiteAdapter) GetUserPermissions(ctx context.Context, userID int64) ([]Permission, error)
- func (a *SQLiteAdapter) GetUserRoles(ctx context.Context, userID int64) ([]Role, error)
- func (a *SQLiteAdapter) ProjectUser(ctx context.Context, userID int64, userState ubstate.UserState) error
- func (a *SQLiteAdapter) ProjectUserRoles(ctx context.Context, userID int64, stateRoles []int64) error
- func (a *SQLiteAdapter) RemoveAllRolesFromUser(ctx context.Context, userID int64) error
- func (a *SQLiteAdapter) RemovePermissionFromRole(ctx context.Context, roleID, permissionID int64) error
- func (a *SQLiteAdapter) UpdateRole(ctx context.Context, roleID int64, name string) error
- func (a *SQLiteAdapter) UpdateUser(ctx context.Context, userID int64, ...) error
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataAdapter ¶
type DataAdapter interface {
// User operations
AddUser(ctx context.Context, userID int64, firstName, lastName, displayName, email string) error
GetUser(ctx context.Context, userID int64) (User, error)
GetUserByEmail(ctx context.Context, email string) (User, error)
UpdateUser(ctx context.Context, userID int64, firstName, lastName, displayName, email string) error
// Role operations
AddRole(ctx context.Context, roleID int64, name string) error
UpdateRole(ctx context.Context, roleID int64, name string) error
GetRoles(ctx context.Context) ([]Role, error)
// Permission operations
CreatePermission(ctx context.Context, name string) (int64, error)
GetPermissions(ctx context.Context) ([]Permission, error)
// Role-Permission operations
AddPermissionToRole(ctx context.Context, roleID, permissionID int64) error
RemovePermissionFromRole(ctx context.Context, roleID, permissionID int64) error
GetRolePermissions(ctx context.Context, roleID int64) ([]Permission, error)
// User-Role operations
AddRoleToUser(ctx context.Context, userID, roleID int64) error
RemoveAllRolesFromUser(ctx context.Context, userID int64) error
GetUserRoles(ctx context.Context, userID int64) ([]Role, error)
GetUserPermissions(ctx context.Context, userID int64) ([]Permission, error)
ProjectUser(ctx context.Context, userID int64, userState ubstate.UserState) error
ProjectUserRoles(ctx context.Context, userID int64, stateRoles []int64) error
}
DataAdapter defines the common interface for user/role/permission operations
func NewDatabase ¶
func NewDatabase(dbType ubconst.DatabaseType, db *sql.DB) DataAdapter
type Permission ¶
Permission represents a permission in the system
type PostgresAdapter ¶
type PostgresAdapter struct {
// contains filtered or unexported fields
}
func NewPostgresAdapter ¶
func NewPostgresAdapter(db *sql.DB) *PostgresAdapter
func (*PostgresAdapter) AddPermissionToRole ¶
func (a *PostgresAdapter) AddPermissionToRole(ctx context.Context, roleID, permissionID int64) error
func (*PostgresAdapter) AddRoleToUser ¶
func (a *PostgresAdapter) AddRoleToUser(ctx context.Context, userID, roleID int64) error
func (*PostgresAdapter) CreatePermission ¶
func (*PostgresAdapter) GetPermissions ¶
func (a *PostgresAdapter) GetPermissions(ctx context.Context) ([]Permission, error)
func (*PostgresAdapter) GetRolePermissions ¶
func (a *PostgresAdapter) GetRolePermissions(ctx context.Context, roleID int64) ([]Permission, error)
func (*PostgresAdapter) GetRoles ¶
func (a *PostgresAdapter) GetRoles(ctx context.Context) ([]Role, error)
func (*PostgresAdapter) GetUserByEmail ¶
func (*PostgresAdapter) GetUserPermissions ¶
func (a *PostgresAdapter) GetUserPermissions(ctx context.Context, userID int64) ([]Permission, error)
func (*PostgresAdapter) GetUserRoles ¶
func (*PostgresAdapter) ProjectUser ¶
func (*PostgresAdapter) ProjectUserRoles ¶
func (*PostgresAdapter) RemoveAllRolesFromUser ¶
func (a *PostgresAdapter) RemoveAllRolesFromUser(ctx context.Context, userID int64) error
func (*PostgresAdapter) RemovePermissionFromRole ¶
func (a *PostgresAdapter) RemovePermissionFromRole(ctx context.Context, roleID, permissionID int64) error
func (*PostgresAdapter) UpdateRole ¶
func (*PostgresAdapter) UpdateUser ¶
type SQLiteAdapter ¶
type SQLiteAdapter struct {
// contains filtered or unexported fields
}
func NewSQLiteAdapter ¶
func NewSQLiteAdapter(db *sql.DB) *SQLiteAdapter
func (*SQLiteAdapter) AddPermissionToRole ¶
func (a *SQLiteAdapter) AddPermissionToRole(ctx context.Context, roleID, permissionID int64) error
func (*SQLiteAdapter) AddRoleToUser ¶
func (a *SQLiteAdapter) AddRoleToUser(ctx context.Context, userID, roleID int64) error
func (*SQLiteAdapter) CreatePermission ¶
func (*SQLiteAdapter) GetPermissions ¶
func (a *SQLiteAdapter) GetPermissions(ctx context.Context) ([]Permission, error)
func (*SQLiteAdapter) GetRolePermissions ¶
func (a *SQLiteAdapter) GetRolePermissions(ctx context.Context, roleID int64) ([]Permission, error)
func (*SQLiteAdapter) GetRoles ¶
func (a *SQLiteAdapter) GetRoles(ctx context.Context) ([]Role, error)
func (*SQLiteAdapter) GetUserByEmail ¶
func (*SQLiteAdapter) GetUserPermissions ¶
func (a *SQLiteAdapter) GetUserPermissions(ctx context.Context, userID int64) ([]Permission, error)
func (*SQLiteAdapter) GetUserRoles ¶
func (*SQLiteAdapter) ProjectUser ¶
func (*SQLiteAdapter) ProjectUserRoles ¶
func (*SQLiteAdapter) RemoveAllRolesFromUser ¶
func (a *SQLiteAdapter) RemoveAllRolesFromUser(ctx context.Context, userID int64) error
func (*SQLiteAdapter) RemovePermissionFromRole ¶
func (a *SQLiteAdapter) RemovePermissionFromRole(ctx context.Context, roleID, permissionID int64) error
func (*SQLiteAdapter) UpdateRole ¶
func (*SQLiteAdapter) UpdateUser ¶
Click to show internal directories.
Click to hide internal directories.