Documentation ¶
Index ¶
- type AddRolePermission
- type FiPer
- func (b *FiPer) AddPermission(permission FiperPermission) (FiperPermission, error)
- func (b *FiPer) AddRole(role FiperRole) (FiperRole, error)
- func (b *FiPer) AddRolePermission(arp AddRolePermission) (rolePermission FiperRolePermission, err error)
- func (b *FiPer) CheckFiPer(rbacList []string) fiber.Handler
- func (b *FiPer) DeletePermission(permissionModel, permissionAction string) (err error)
- func (b *FiPer) DeleteRole(roleName string) (err error)
- func (b *FiPer) DeleteRolePermission(roleName, permissionModel, permissionAction string) (err error)
- func (b *FiPer) GetPermissions() (permissions []FiperPermission, err error)
- func (b *FiPer) GetRolePermissions() (rolePermissions []FiperRolePermission, err error)
- func (b *FiPer) GetRoles() (roles []FiperRole, err error)
- func (b *FiPer) GetUserPermits(userId string) (permits Permits, err error)
- func (b *FiPer) GrantUserPermission(userId, permissionModel, permissionAction string) (permits Permits, err error)
- func (b *FiPer) GrantUserRole(userId, roleName string) (permits Permits, err error)
- func (b *FiPer) MigrateTables() (err error)
- func (b *FiPer) RevokeUserPermit(userId, permit string) (permits Permits, err error)
- func (b *FiPer) ValidatePermits(userPermits []string) error
- type FiperPermission
- type FiperRole
- type FiperRolePermission
- type Permits
- type UserPermit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddRolePermission ¶
AddRolePermission represents a model used to store RolePermission
type FiPer ¶
func (*FiPer) AddPermission ¶
func (b *FiPer) AddPermission(permission FiperPermission) (FiperPermission, error)
AddPermission - stores a permission in the database
func (*FiPer) AddRolePermission ¶
func (b *FiPer) AddRolePermission(arp AddRolePermission) (rolePermission FiperRolePermission, err error)
AddRolePermission - stores a role permission in the database
func (*FiPer) CheckFiPer ¶
func (*FiPer) DeletePermission ¶
DeletePermission - removes a stored permission from database
func (*FiPer) DeleteRole ¶
DeleteRole - removes a stored role from database
func (*FiPer) DeleteRolePermission ¶
func (b *FiPer) DeleteRolePermission(roleName, permissionModel, permissionAction string) (err error)
DeleteRolePermission - removes a stored role permission from database
func (*FiPer) GetPermissions ¶
func (b *FiPer) GetPermissions() (permissions []FiperPermission, err error)
GetPermissions - get stored permissions in the database
func (*FiPer) GetRolePermissions ¶
func (b *FiPer) GetRolePermissions() (rolePermissions []FiperRolePermission, err error)
GetRolePermissions - get stored role permissions in the database
func (*FiPer) GetUserPermits ¶
GetUserPermits - get user roles and permissions in the database
func (*FiPer) GrantUserPermission ¶
func (b *FiPer) GrantUserPermission(userId, permissionModel, permissionAction string) (permits Permits, err error)
GrantUserPermission - grant user permission in the database
func (*FiPer) GrantUserRole ¶
GrantUserRole - grant user role in the database
func (*FiPer) MigrateTables ¶
func (*FiPer) RevokeUserPermit ¶
RevokeUserPermit - revoke user role and permission in the database
func (*FiPer) ValidatePermits ¶
type FiperPermission ¶
type FiperPermission struct { bun.BaseModel `bun:"table:fiper_permissions"` ID uuid.UUID `bun:"id,pk,type:uuid,default:uuid_generate_v4()"` Model string `bun:"model,notnull,unique:group_permission"` Action string `bun:"action,notnull,unique:group_permission"` }
Permission represents the database model of permissions
type FiperRole ¶
type FiperRole struct { bun.BaseModel `bun:"table:fiper_roles"` ID uuid.UUID `bun:"id,pk,type:uuid,default:uuid_generate_v4()"` Name string `bun:"name,unique,notnull"` }
Role represents the database model of roles
type FiperRolePermission ¶
type FiperRolePermission struct { bun.BaseModel `bun:"table:fiper_role_permissions"` RoleID uuid.UUID `json:"-" bun:"role_id,pk,notnull,type:uuid,unique:group_role_permission"` Role *FiperRole `bun:"rel:belongs-to,join:role_id=id"` PermissionID uuid.UUID `json:"-" bun:"permission_id,pk,notnull,type:uuid,unique:group_role_permission"` Permission *FiperPermission `bun:"rel:belongs-to,join:permission_id=id"` }
RolePermission represents the database that stores the relationship between roles and permissions