Documentation
¶
Index ¶
- Variables
- type GroupCreateInput
- type GroupService
- func (self *GroupService) AddUserToGroup(ctx context.Context, requesterUserID, targetUserID, groupID uuid.UUID) error
- func (self *GroupService) CreateGroup(ctx context.Context, userID uuid.UUID, input *GroupCreateInput) (*ent.Group, error)
- func (self *GroupService) DeleteGroup(ctx context.Context, userID uuid.UUID, groupID uuid.UUID) error
- func (self *GroupService) GetGroupByID(ctx context.Context, userID uuid.UUID, groupID uuid.UUID) (*ent.Group, error)
- func (self *GroupService) GetGroupMembers(ctx context.Context, requesterUserID, groupID uuid.UUID) ([]*ent.User, error)
- func (self *GroupService) GetGroupPermissions(ctx context.Context, requesterUserID uuid.UUID, groupID uuid.UUID) ([]*ent.Permission, error)
- func (self *GroupService) GetUserGroups(ctx context.Context, requesterUserID uuid.UUID, targetUserID uuid.UUID) ([]*ent.Group, error)
- func (self *GroupService) GrantPermissionToGroup(ctx context.Context, requesterUserID, groupID uuid.UUID, ...) (*ent.Permission, error)
- func (self *GroupService) ListGroups(ctx context.Context, userID uuid.UUID) ([]*ent.Group, error)
- func (self *GroupService) RemoveUserFromGroup(ctx context.Context, requesterUserID, targetUserID, groupID uuid.UUID) error
- func (self *GroupService) RevokePermissionFromGroup(ctx context.Context, requesterUserID uuid.UUID, groupID uuid.UUID, ...) error
- func (self *GroupService) UpdateGroup(ctx context.Context, userID uuid.UUID, groupID uuid.UUID, ...) (*ent.Group, error)
Constants ¶
This section is empty.
Variables ¶
var SUPER_USER_ID = uuid.MustParse("60303901-c88f-47f0-b888-ecf92988d9fc")
Skips permission checks
Functions ¶
This section is empty.
Types ¶
type GroupCreateInput ¶
Input for creating group
type GroupService ¶
type GroupService struct {
// contains filtered or unexported fields
}
Integrate group management with internal permissions and kubernetes RBAC
func NewGroupService ¶
func NewGroupService(repo repositories.RepositoriesInterface, rbacManager *k8s.RBACManager) *GroupService
func (*GroupService) AddUserToGroup ¶
func (*GroupService) CreateGroup ¶
func (self *GroupService) CreateGroup(ctx context.Context, userID uuid.UUID, input *GroupCreateInput) (*ent.Group, error)
func (*GroupService) DeleteGroup ¶
func (self *GroupService) DeleteGroup(ctx context.Context, userID uuid.UUID, groupID uuid.UUID) error
DeleteGroup deletes a group if the user has permissions
func (*GroupService) GetGroupByID ¶
func (self *GroupService) GetGroupByID(ctx context.Context, userID uuid.UUID, groupID uuid.UUID) (*ent.Group, error)
GetGroupByID retrieves a group by its ID
func (*GroupService) GetGroupMembers ¶
func (self *GroupService) GetGroupMembers(ctx context.Context, requesterUserID, groupID uuid.UUID) ([]*ent.User, error)
GetGroupMembers lists all users who are members of a group
func (*GroupService) GetGroupPermissions ¶
func (self *GroupService) GetGroupPermissions( ctx context.Context, requesterUserID uuid.UUID, groupID uuid.UUID, ) ([]*ent.Permission, error)
GetGroupPermissions lists all permissions for a group
func (*GroupService) GetUserGroups ¶
func (self *GroupService) GetUserGroups( ctx context.Context, requesterUserID uuid.UUID, targetUserID uuid.UUID, ) ([]*ent.Group, error)
GetUserGroups gets all groups a user belongs to
func (*GroupService) GrantPermissionToGroup ¶
func (self *GroupService) GrantPermissionToGroup( ctx context.Context, requesterUserID, groupID uuid.UUID, permAction schema.PermittedAction, resourceType schema.ResourceType, selector schema.ResourceSelector, ) (*ent.Permission, error)
GrantPermissionToGroup grants a permission to a group
func (*GroupService) ListGroups ¶
ListGroups retrieves all groups the user has permission to view
func (*GroupService) RemoveUserFromGroup ¶
func (self *GroupService) RemoveUserFromGroup(ctx context.Context, requesterUserID, targetUserID, groupID uuid.UUID) error
RemoveUserFromGroup removes a user from a group if the requester has permission
func (*GroupService) RevokePermissionFromGroup ¶
func (self *GroupService) RevokePermissionFromGroup( ctx context.Context, requesterUserID uuid.UUID, groupID uuid.UUID, permissionID uuid.UUID, ) error
RevokePermissionFromGroup revokes a permission from a group
func (*GroupService) UpdateGroup ¶
func (self *GroupService) UpdateGroup(ctx context.Context, userID uuid.UUID, groupID uuid.UUID, input GroupCreateInput) (*ent.Group, error)
UpdateGroup updates a group if the user has permission