 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- type DataAdapter
- type ListRolesWithUserCountsRow
- type ListUserOrganizationRolesRow
- type Organization
- type Permission
- type PostgresAdapter
- func (a *PostgresAdapter) AddOrganization(ctx context.Context, id int64, name string, systemName string, status string) error
- func (a *PostgresAdapter) AddPermissionToRole(ctx context.Context, roleID int64, permission string) error
- func (a *PostgresAdapter) AddRole(ctx context.Context, roleID int64, organizationID int64, name string, ...) error
- func (a *PostgresAdapter) AddUser(ctx context.Context, userID int64, ...) error
- func (a *PostgresAdapter) AddUserToRole(ctx context.Context, userID int64, roleID int64) error
- func (a *PostgresAdapter) DeleteRole(ctx context.Context, roleID int64) error
- func (a *PostgresAdapter) GetAllUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
- func (a *PostgresAdapter) GetOrganization(ctx context.Context, organizationID int64) (Organization, error)
- func (a *PostgresAdapter) GetOrganizationBySystemName(ctx context.Context, systemName string) (Organization, error)
- func (a *PostgresAdapter) GetOrganizationRoles(ctx context.Context, organizationID int64) ([]RoleRow, error)
- func (a *PostgresAdapter) GetRolePermissions(ctx context.Context, roleID int64) ([]string, error)
- func (a *PostgresAdapter) GetRolesForUser(ctx context.Context, userID int64) ([]RoleRow, 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) GetUserOrganizationRoles(ctx context.Context, userID int64, organizationId int64) ([]RoleRow, error)
- func (a *PostgresAdapter) GetUsersInRole(ctx context.Context, roleID int64) ([]User, error)
- func (a *PostgresAdapter) ListOrganizations(ctx context.Context) ([]Organization, error)
- func (a *PostgresAdapter) ListOrganizationsRolesWithUserCounts(ctx context.Context, organizationId int64) ([]ListRolesWithUserCountsRow, error)
- func (a *PostgresAdapter) ListUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
- func (a *PostgresAdapter) OrganizationsCount(ctx context.Context) (int64, error)
- func (a *PostgresAdapter) RemoveAllRolesFromUser(ctx context.Context, userID int64) error
- func (a *PostgresAdapter) RemovePermissionFromRole(ctx context.Context, roleID int64, permission string) error
- func (a *PostgresAdapter) RemoveUserFromRole(ctx context.Context, userID int64, roleID int64) error
- func (a *PostgresAdapter) SearchUsers(ctx context.Context, searchTerm string, limit, offset int) ([]User, error)
- func (a *PostgresAdapter) UpdateOrganization(ctx context.Context, id int64, name string, systemName string, status string) error
- func (a *PostgresAdapter) UpdateRole(ctx context.Context, roleID int64, name string, systemName string) error
- func (a *PostgresAdapter) UpdateUser(ctx context.Context, userID int64, ...) error
- func (a *PostgresAdapter) UpdateUserLoginStats(ctx context.Context, userID int64, lastLogin int64, loginCount int64) error
- func (a *PostgresAdapter) UserAddApiKey(ctx context.Context, userID int64, organizationId int64, apiKeyId string, ...) error
- func (a *PostgresAdapter) UserDeleteApiKey(ctx context.Context, userID int64, apiKeyId string) error
- func (a *PostgresAdapter) UserGetApiKey(ctx context.Context, apiKeyHash string) (UserApiKeyWithHash, error)
- func (a *PostgresAdapter) UserListApiKeys(ctx context.Context, userID int64) ([]UserApiKeyNoHash, error)
- func (a *PostgresAdapter) UsersCount(ctx context.Context) (int64, error)
 
- type RoleRow
- type SQLiteAdapter
- func (a *SQLiteAdapter) AddOrganization(ctx context.Context, id int64, name string, systemName string, status string) error
- func (a *SQLiteAdapter) AddPermissionToRole(ctx context.Context, roleID int64, permission string) error
- func (a *SQLiteAdapter) AddRole(ctx context.Context, roleID int64, organizationID int64, name string, ...) error
- func (a *SQLiteAdapter) AddUser(ctx context.Context, userID int64, ...) error
- func (a *SQLiteAdapter) AddUserToRole(ctx context.Context, userID int64, roleID int64) error
- func (a *SQLiteAdapter) DeleteRole(ctx context.Context, roleID int64) error
- func (a *SQLiteAdapter) GetAllUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
- func (a *SQLiteAdapter) GetOrganization(ctx context.Context, organizationID int64) (Organization, error)
- func (a *SQLiteAdapter) GetOrganizationBySystemName(ctx context.Context, systemName string) (Organization, error)
- func (a *SQLiteAdapter) GetOrganizationRoles(ctx context.Context, organizationID int64) ([]RoleRow, error)
- func (a *SQLiteAdapter) GetRolePermissions(ctx context.Context, roleID int64) ([]string, error)
- func (a *SQLiteAdapter) GetRolesForUser(ctx context.Context, userID int64) ([]RoleRow, 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) GetUserOrganizationRoles(ctx context.Context, userID int64, organizationId int64) ([]RoleRow, error)
- func (a *SQLiteAdapter) GetUsersInRole(ctx context.Context, roleID int64) ([]User, error)
- func (a *SQLiteAdapter) ListOrganizations(ctx context.Context) ([]Organization, error)
- func (a *SQLiteAdapter) ListOrganizationsRolesWithUserCounts(ctx context.Context, organizationId int64) ([]ListRolesWithUserCountsRow, error)
- func (a *SQLiteAdapter) ListUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
- func (a *SQLiteAdapter) OrganizationsCount(ctx context.Context) (int64, error)
- func (a *SQLiteAdapter) RemoveAllRolesFromUser(ctx context.Context, userID int64) error
- func (a *SQLiteAdapter) RemovePermissionFromRole(ctx context.Context, roleID int64, permission string) error
- func (a *SQLiteAdapter) RemoveUserFromRole(ctx context.Context, userID int64, roleID int64) error
- func (a *SQLiteAdapter) SearchUsers(ctx context.Context, searchTerm string, limit, offset int) ([]User, error)
- func (a *SQLiteAdapter) UpdateOrganization(ctx context.Context, id int64, name string, systemName string, status string) error
- func (a *SQLiteAdapter) UpdateRole(ctx context.Context, roleID int64, name string, systemName string) error
- func (a *SQLiteAdapter) UpdateUser(ctx context.Context, userID int64, ...) error
- func (a *SQLiteAdapter) UpdateUserLoginStats(ctx context.Context, userID int64, lastLogin int64, loginCount int64) error
- func (a *SQLiteAdapter) UserAddApiKey(ctx context.Context, userID int64, organizationId int64, apiKeyId string, ...) error
- func (a *SQLiteAdapter) UserDeleteApiKey(ctx context.Context, userID int64, apiKeyId string) error
- func (a *SQLiteAdapter) UserGetApiKey(ctx context.Context, apiKeyHash string) (UserApiKeyWithHash, error)
- func (a *SQLiteAdapter) UserListApiKeys(ctx context.Context, userID int64) ([]UserApiKeyNoHash, error)
- func (a *SQLiteAdapter) UsersCount(ctx context.Context) (int64, error)
 
- type User
- type UserApiKeyNoHash
- type UserApiKeyWithHash
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, verified bool, createdAt int64, updatedAt int64) error
	GetUser(ctx context.Context, userID int64) (User, error)
	GetUserByEmail(ctx context.Context, email string) (User, error)
	SearchUsers(ctx context.Context, searchTerm string, limit, offset int) ([]User, error)
	UpdateUser(ctx context.Context, userID int64, firstName, lastName, displayName, email string, verified bool, updatedAt int64) error
	AddOrganization(ctx context.Context, id int64, name string, systemName string, status string) error
	GetOrganization(ctx context.Context, organizationID int64) (Organization, error)
	ListOrganizations(ctx context.Context) ([]Organization, error)
	GetOrganizationBySystemName(ctx context.Context, systemName string) (Organization, error)
	UpdateOrganization(ctx context.Context, id int64, name string, systemName string, status string) error
	// Role operations
	AddRole(ctx context.Context, roleID int64, organizationID int64, name string, systemName string) error
	UpdateRole(ctx context.Context, roleID int64, name string, systemName string) error
	DeleteRole(ctx context.Context, roleID int64) error
	GetOrganizationRoles(ctx context.Context, organizationID int64) ([]RoleRow, error)
	AddPermissionToRole(ctx context.Context, roleID int64, permission string) error
	RemovePermissionFromRole(ctx context.Context, roleID int64, permission string) error
	GetRolePermissions(ctx context.Context, roleID int64) ([]string, error)
	// User-Role operations
	AddUserToRole(ctx context.Context, userID int64, roleID int64) error
	RemoveUserFromRole(ctx context.Context, userID int64, roleID int64) error
	RemoveAllRolesFromUser(ctx context.Context, userID int64) error
	GetUserOrganizationRoles(ctx context.Context, userID int64, organizationId int64) ([]RoleRow, error)
	GetAllUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
	ListUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
	OrganizationsCount(ctx context.Context) (int64, error)
	UsersCount(ctx context.Context) (int64, error)
	UpdateUserLoginStats(ctx context.Context, userID int64, lastLogin int64, loginCount int64) error
	ListOrganizationsRolesWithUserCounts(ctx context.Context, organizationId int64) ([]ListRolesWithUserCountsRow, error)
	GetUsersInRole(ctx context.Context, roleID int64) ([]User, error)
	GetRolesForUser(ctx context.Context, userID int64) ([]RoleRow, error)
	UserAddApiKey(ctx context.Context, userID int64, organizationId int64, apiKeyId string, apiKeyHash, name string, createdAt time.Time, expiresAt time.Time) error
	UserDeleteApiKey(ctx context.Context, userID int64, apiKeyId string) error
	UserListApiKeys(ctx context.Context, userID int64) ([]UserApiKeyNoHash, error)
	UserGetApiKey(ctx context.Context, apiKeyId string) (UserApiKeyWithHash, error)
}
    DataAdapter defines the common interface for user/role/permission operations
func NewDatabase ¶
func NewDatabase(dbType ubconst.DatabaseType, db *sql.DB) DataAdapter
type ListRolesWithUserCountsRow ¶ added in v0.0.16
type ListUserOrganizationRolesRow ¶ added in v0.0.7
type Organization ¶ added in v0.0.7
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) AddOrganization ¶ added in v0.0.7
func (*PostgresAdapter) AddPermissionToRole ¶
func (*PostgresAdapter) AddUserToRole ¶ added in v0.0.7
func (*PostgresAdapter) DeleteRole ¶ added in v0.0.7
func (a *PostgresAdapter) DeleteRole(ctx context.Context, roleID int64) error
func (*PostgresAdapter) GetAllUserOrganizationRoles ¶ added in v0.0.16
func (a *PostgresAdapter) GetAllUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
func (*PostgresAdapter) GetOrganization ¶ added in v0.0.7
func (a *PostgresAdapter) GetOrganization(ctx context.Context, organizationID int64) (Organization, error)
func (*PostgresAdapter) GetOrganizationBySystemName ¶ added in v0.0.7
func (a *PostgresAdapter) GetOrganizationBySystemName(ctx context.Context, systemName string) (Organization, error)
func (*PostgresAdapter) GetOrganizationRoles ¶ added in v0.0.7
func (*PostgresAdapter) GetRolePermissions ¶
func (*PostgresAdapter) GetRolesForUser ¶ added in v0.0.18
func (*PostgresAdapter) GetUserByEmail ¶
func (*PostgresAdapter) GetUserOrganizationRoles ¶ added in v0.0.7
func (*PostgresAdapter) GetUsersInRole ¶ added in v0.0.18
func (*PostgresAdapter) ListOrganizations ¶ added in v0.0.7
func (a *PostgresAdapter) ListOrganizations(ctx context.Context) ([]Organization, error)
func (*PostgresAdapter) ListOrganizationsRolesWithUserCounts ¶ added in v0.0.16
func (a *PostgresAdapter) ListOrganizationsRolesWithUserCounts(ctx context.Context, organizationId int64) ([]ListRolesWithUserCountsRow, error)
func (*PostgresAdapter) ListUserOrganizationRoles ¶ added in v0.0.7
func (a *PostgresAdapter) ListUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
func (*PostgresAdapter) OrganizationsCount ¶ added in v0.0.16
func (a *PostgresAdapter) OrganizationsCount(ctx context.Context) (int64, error)
func (*PostgresAdapter) RemoveAllRolesFromUser ¶
func (a *PostgresAdapter) RemoveAllRolesFromUser(ctx context.Context, userID int64) error
func (*PostgresAdapter) RemovePermissionFromRole ¶
func (*PostgresAdapter) RemoveUserFromRole ¶ added in v0.0.7
func (*PostgresAdapter) SearchUsers ¶ added in v0.0.18
func (*PostgresAdapter) UpdateOrganization ¶ added in v0.0.7
func (*PostgresAdapter) UpdateRole ¶
func (*PostgresAdapter) UpdateUser ¶
func (*PostgresAdapter) UpdateUserLoginStats ¶ added in v0.0.16
func (*PostgresAdapter) UserAddApiKey ¶ added in v0.0.18
func (*PostgresAdapter) UserDeleteApiKey ¶ added in v0.0.18
func (*PostgresAdapter) UserGetApiKey ¶ added in v0.0.18
func (a *PostgresAdapter) UserGetApiKey(ctx context.Context, apiKeyHash string) (UserApiKeyWithHash, error)
func (*PostgresAdapter) UserListApiKeys ¶ added in v0.0.18
func (a *PostgresAdapter) UserListApiKeys(ctx context.Context, userID int64) ([]UserApiKeyNoHash, error)
func (*PostgresAdapter) UsersCount ¶ added in v0.0.16
func (a *PostgresAdapter) UsersCount(ctx context.Context) (int64, error)
type SQLiteAdapter ¶
type SQLiteAdapter struct {
	// contains filtered or unexported fields
}
    func NewSQLiteAdapter ¶
func NewSQLiteAdapter(db *sql.DB) *SQLiteAdapter
func (*SQLiteAdapter) AddOrganization ¶ added in v0.0.7
func (*SQLiteAdapter) AddPermissionToRole ¶
func (*SQLiteAdapter) AddUserToRole ¶ added in v0.0.7
func (*SQLiteAdapter) DeleteRole ¶ added in v0.0.7
func (a *SQLiteAdapter) DeleteRole(ctx context.Context, roleID int64) error
func (*SQLiteAdapter) GetAllUserOrganizationRoles ¶ added in v0.0.16
func (a *SQLiteAdapter) GetAllUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
func (*SQLiteAdapter) GetOrganization ¶ added in v0.0.7
func (a *SQLiteAdapter) GetOrganization(ctx context.Context, organizationID int64) (Organization, error)
func (*SQLiteAdapter) GetOrganizationBySystemName ¶ added in v0.0.7
func (a *SQLiteAdapter) GetOrganizationBySystemName(ctx context.Context, systemName string) (Organization, error)
func (*SQLiteAdapter) GetOrganizationRoles ¶ added in v0.0.7
func (*SQLiteAdapter) GetRolePermissions ¶
func (*SQLiteAdapter) GetRolesForUser ¶ added in v0.0.18
func (*SQLiteAdapter) GetUserByEmail ¶
func (*SQLiteAdapter) GetUserOrganizationRoles ¶ added in v0.0.7
func (*SQLiteAdapter) GetUsersInRole ¶ added in v0.0.18
func (*SQLiteAdapter) ListOrganizations ¶ added in v0.0.7
func (a *SQLiteAdapter) ListOrganizations(ctx context.Context) ([]Organization, error)
func (*SQLiteAdapter) ListOrganizationsRolesWithUserCounts ¶ added in v0.0.16
func (a *SQLiteAdapter) ListOrganizationsRolesWithUserCounts(ctx context.Context, organizationId int64) ([]ListRolesWithUserCountsRow, error)
func (*SQLiteAdapter) ListUserOrganizationRoles ¶ added in v0.0.7
func (a *SQLiteAdapter) ListUserOrganizationRoles(ctx context.Context, userID int64) ([]ListUserOrganizationRolesRow, error)
func (*SQLiteAdapter) OrganizationsCount ¶ added in v0.0.16
func (a *SQLiteAdapter) OrganizationsCount(ctx context.Context) (int64, error)
func (*SQLiteAdapter) RemoveAllRolesFromUser ¶
func (a *SQLiteAdapter) RemoveAllRolesFromUser(ctx context.Context, userID int64) error
func (*SQLiteAdapter) RemovePermissionFromRole ¶
func (*SQLiteAdapter) RemoveUserFromRole ¶ added in v0.0.7
func (*SQLiteAdapter) SearchUsers ¶ added in v0.0.18
func (*SQLiteAdapter) UpdateOrganization ¶ added in v0.0.7
func (*SQLiteAdapter) UpdateRole ¶
func (*SQLiteAdapter) UpdateUser ¶
func (*SQLiteAdapter) UpdateUserLoginStats ¶ added in v0.0.16
func (*SQLiteAdapter) UserAddApiKey ¶ added in v0.0.18
func (*SQLiteAdapter) UserDeleteApiKey ¶ added in v0.0.18
func (*SQLiteAdapter) UserGetApiKey ¶ added in v0.0.18
func (a *SQLiteAdapter) UserGetApiKey(ctx context.Context, apiKeyHash string) (UserApiKeyWithHash, error)
func (*SQLiteAdapter) UserListApiKeys ¶ added in v0.0.18
func (a *SQLiteAdapter) UserListApiKeys(ctx context.Context, userID int64) ([]UserApiKeyNoHash, error)
func (*SQLiteAdapter) UsersCount ¶ added in v0.0.16
func (a *SQLiteAdapter) UsersCount(ctx context.Context) (int64, error)
type User ¶
type User struct {
	UserID      int64
	FirstName   string
	LastName    string
	DisplayName string
	Email       string
	Verified    bool
}
    User represents a user in the system
type UserApiKeyNoHash ¶ added in v0.0.18
 Click to show internal directories. 
   Click to hide internal directories.