Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessRole ¶
type AccessRole int8
AccessRole represents access role type
const ( // SuperAdminRole has all permissions SuperAdminRole AccessRole = iota + 1 // AdminRole has admin specific permissions AdminRole // TenantAdminRole can edit tenant specific things TenantAdminRole // UserRole is a standard user UserRole )
type AuthUser ¶
type AuthUser struct {
ID int64
TenantID int32
Username string
Email string
Role AccessRole
}
AuthUser represents data stored in session/context for a user
type Logger ¶
type Logger interface {
// source, msg, error, params
Log(context.Context, string, string, error, map[string]interface{})
}
Logger represents logging interface
type RBACService ¶
type RBACService interface {
EnforceRole(context.Context, AccessRole) bool
EnforceUser(context.Context, int64) bool
EnforceTenant(context.Context, int32) bool
EnforceTenantAdmin(context.Context, int32) bool
EnforceTenantAndRole(context.Context, AccessRole, int32) bool
IsLowerRole(context.Context, AccessRole) bool
}
RBACService represents role-based access control service interface
type User ¶
type User struct {
ID int64
FirstName string
LastName string
Username string
Password string
Email string
Phone string
Address string
Active bool
Token string
RoleID int32
TenantID int32
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time
LastLogin *time.Time
LastPasswordChange *time.Time
}
User represents user domain model
func (*User) BeforeInsert ¶
BeforeInsert hooks into insert operations, setting createdAt and updatedAt to current time
func (*User) BeforeUpdate ¶
BeforeUpdate hooks into update operations, setting updatedAt to current time
func (*User) UpdateLoginDetails ¶
UpdateLoginDetails updates login related fields
Click to show internal directories.
Click to hide internal directories.