Documentation
¶
Index ¶
- Constants
- func IsValidLang(lang Lang) bool
- type Action
- type Authenticable
- type ErrorResponse
- type EventFSM
- type FSM
- type Gender
- type Lang
- type Permission
- type RWXD
- type Resource
- type ResourceStatus
- type Role
- type RoleResourcePermission
- type RoleWildCardPermission
- type SR
- type StateFSM
- type SuccessResponse
Constants ¶
View Source
const ( MaleGender = Gender("male") FemaleGender = Gender("female") )
View Source
const ( ResourceModuleType = ResourceStatus("module") ResourceAPIType = ResourceStatus("API") ResourceFileType = ResourceStatus("file") )
Variables ¶
This section is empty.
Functions ¶
func IsValidLang ¶
Types ¶
type Authenticable ¶
type ErrorResponse ¶
type ErrorResponse struct {
Success bool `json:"Success"`
Message string `json:"message"`
Errors []interface{} `json:"errors"`
Meta map[string]interface{} `json:"meta,omitempty"`
}
func NewErrorResponse ¶
func NewErrorResponse( message string, errors interface{}, ) *ErrorResponse
func (*ErrorResponse) WithMeta ¶
func (e *ErrorResponse) WithMeta(meta map[string]interface{}) *ErrorResponse
type Permission ¶
Permission describe the rules for accessing resources.
type RWXD ¶
type RWXD struct {
R bool // ReadAction permission
W bool // WriteAction permission
X bool // ExecuteAction permission
D bool // DeleteAction permission
}
RWXD specifies a set of permissions for resources.
type Resource ¶
type Resource struct {
ID types.ID
Name string
Description string
Type string // Type of resource (e.g., "module", "file", "API")
Internal bool
CreatedAt time.Time
UpdatedAt time.Time
}
Resource represents a protectable models within the system.
type ResourceStatus ¶
type ResourceStatus string
func (ResourceStatus) IsValid ¶
func (a ResourceStatus) IsValid() bool
type Role ¶
type Role struct {
ID types.ID // Unique code for the role
Name string // Name displayed to end users
Description string // Overview of the role
Internal bool // Indicates if the role is predefined and unmodifiable
// GroupID types.ID // Group associated with this role
CreatedAt time.Time // Timestamp for role creation
UpdatedAt time.Time // Timestamp for the last role update
}
Role represents a stable set of permissions linked to business functions.
type RoleResourcePermission ¶
type RoleResourcePermission struct {
RoleID types.ID // Code of the role
ResourceID types.ID // Code of the resource
Permissions Permission // Allowed and denied actions
CreatedAt time.Time // Timestamp for permission assignment
UpdatedAt time.Time // Timestamp for the last permission update
}
RoleResourcePermission defines permissions for a role on a specific resource.
type RoleWildCardPermission ¶
type RoleWildCardPermission struct {
RoleID types.ID // Code of the role
ResourcePattern string // Resource pattern using wildcards (e.g., "resource.*")
Priority int // Priority of the wildcard permission
Permissions Permission // Allowed and denied actions
CreatedAt time.Time // Timestamp for permission assignment
UpdatedAt time.Time // Timestamp for the last permission update
}
RoleWildCardPermission defines permissions for a role on a pattern of resources.
type SR ¶
type SR[T interface{}] struct {
Success bool `json:"success"`
Message string `json:"message"`
Data T `json:"data"`
Meta map[string]interface{} `json:"meta,omitempty"`
}
func ForTestSuccessResponse ¶
func ForTestSuccessResponse[T interface{}]() SR[T]
type SuccessResponse ¶
type SuccessResponse[T any] struct { Success bool `json:"success"` Message string `json:"message"` Data T `json:"data"` Meta map[string]interface{} `json:"meta,omitempty"` }
func NewSuccessResponse ¶
func NewSuccessResponse[T any]( message string, data T, ) *SuccessResponse[T]
func (*SuccessResponse[T]) WithMeta ¶
func (e *SuccessResponse[T]) WithMeta(meta map[string]interface{}) *SuccessResponse[T]
Click to show internal directories.
Click to hide internal directories.