Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunMigrations ¶
RunMigrations is a function that runs the migrations for the authz package.
Types ¶
type APIKey ¶
type APIKey struct {
// ID is the primary key of the API key.
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid()"`
// Key is the API key.
Key string `gorm:"uniqueIndex" validate:"required,alphanum,gt=3,lt=255,lowercase"`
// Description is the description of the API key.
Description *string `validate:"omitempty,max=255"`
// CreatedAt is the time the API key was created.
CreatedAt time.Time
// UpdatedAt is the time the API key was last updated.
UpdatedAt time.Time
// DeletedAt is the time the API key was deleted.
DeletedAt gorm.DeletedAt
}
APIKey is an API key.
type APIKeyRole ¶
type APIKeyRole struct {
// APIKeyID is the primary key of the API key.
KeyID uuid.UUID `gorm:"primaryKey"`
Key APIKey
// RoleID is the primary key of the role.
RoleID uuid.UUID `gorm:"primaryKey"`
Role Role
// TeamID is the primary key of the team.
TeamID uuid.UUID `gorm:"primaryKey"`
Team Team
// CreatedAt is the time the API key role was created.
CreatedAt time.Time
// UpdatedAt is the time the API key role was last updated.
UpdatedAt time.Time
// DeletedAt is the time the API key role was deleted.
DeletedAt gorm.DeletedAt
}
APIKeyRole is a user role.
type Permission ¶
type Permission struct {
// ID is the primary key of the permission.
ID uint `json:"id" gorm:"primaryKey"`
// Scope is the unique identifier of the permission.
Scope string `json:"scope" gorm:"uniqueIndex" validate:"required,alphanum,gt=3,lt=255,lowercase"`
// Description is the description of the permission.
Description *string `json:"description" validate:"omitempty,max=255"`
// Roles are the roles that have the permission.
Roles *[]Role `gorm:"many2many:role_permissions;"`
// CreatedAt is the time the permission was created.
CreatedAt time.Time
// UpdatedAt is the time the permission was last updated.
UpdatedAt time.Time
// DeletedAt is the time the permission was deleted.
DeletedAt gorm.DeletedAt
}
Permission is a permission that a user can have.
func (*Permission) Validate ¶
func (p *Permission) Validate() error
Validate validates the permission.
type Role ¶
type Role struct {
ID uuid.UUID `gorm:"type:uuid;default:gen_random_uuid()"`
Name string `gorm:"uniqueIndex"`
Description string `validate:"omitempty,max=255"`
Permissions *[]Permission `gorm:"many2many:role_permissions;"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt
}
Role is a role that a user can have.
type Team ¶
type Team struct {
// ID is the primary key of the team.
ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid()"`
// Name is the name of the team.
Name string `json:"name" validate:"required,alphanum,gt=3,lt=255"`
// Slug is the unique identifier of the team.
Slug string `json:"slug" gorm:"uniqueIndex" validate:"required,alphanum,gt=3,lt=255,lowercase"`
// Description is the description of the team.
Description *string `json:"description" validate:"omitempty,max=255"`
// Users are the users in the team.
Users *[]User `gorm:"many2many:user_teams;"`
// CreatedAt is the time the team was created.
CreatedAt time.Time
// UpdatedAt is the time the team was last updated.
UpdatedAt time.Time
// DeletedAt is the time the team was deleted.
DeletedAt gorm.DeletedAt
}
Team is a group of users.
type User ¶
type User struct {
Teams *[]Team `gorm:"many2many:user_teams;"`
Roles *[]Role `gorm:"many2many:user_roles;"`
*adapters.GothUser
}
User is a user.
type UserRole ¶
type UserRole struct {
// UserID is the primary key of the user.
UserID uuid.UUID `gorm:"primaryKey"`
User User
// TeamID is the primary key of the team.
TeamID uuid.UUID `gorm:"primaryKey"`
Team Team
// RoleID is the primary key of the role.
RoleID uuid.UUID `gorm:"primaryKey"`
Role Role
// CreatedAt is the time the user role was created.
CreatedAt time.Time
// UpdatedAt is the time the user role was last updated.
UpdatedAt time.Time
// DeletedAt is the time the user role was deleted.
DeletedAt gorm.DeletedAt
}
UserRole is a user role.
Click to show internal directories.
Click to hide internal directories.