Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertResourceType ¶
func ConvertResourceType(resourceTypeStr string) (models.ResourceType, bool)
Types ¶
type Member ¶
type Member struct { // ID the uniq id of the member entry ID uint // MemberInfo username or groupID MemberInfo string // MemberName MemberName string // MemberPath the path of the member MemberPath string // MemberType user or group MemberType models.MemberType // SourceInfo direct or from application/group SourceInfo string // Role the role name that bind Role string // GrantedBy user who grant the role GrantedBy string // GrantTime GrantTime time.Time }
type PostMember ¶
type PostMember struct { // ResourceType group/application/cluster ResourceType string // ResourceID group id;application id ... ResourceID uint // MemberInfo group id / username MemberInfo uint // MemberType user or group MemberType models.MemberType // Role owner/maintainer/develop/... Role string }
type Service ¶
type Service interface { // CreateMember post a new member CreateMember(ctx context.Context, postMember PostMember) (*models.Member, error) // GetMember return the current user member of direct or parent GetMember(ctx context.Context, memberID uint) (*models.Member, error) // UpdateMember update the member by the memberID UpdateMember(ctx context.Context, memberID uint, role string) (*models.Member, error) // RemoveMember Remove the member by the memberID RemoveMember(ctx context.Context, memberID uint) error // ListMember list all the member of the resource ListMember(ctx context.Context, resourceType string, resourceID uint) ([]models.Member, error) // GetMemberOfResource return the current user's role of the resource (member from direct or parent) GetMemberOfResource(ctx context.Context, resourceType string, resourceID string) (*models.Member, error) // RequirePermissionEqualOrHigher helps to check if your permission is higher than specified member RequirePermissionEqualOrHigher(ctx context.Context, role, resourceType string, resourceID uint) error }
nolint
func NewService ¶
func NewService(roleService roleservice.Service, oauthManager oauthmanager.Manager, manager *managerparam.Manager) Service
Click to show internal directories.
Click to hide internal directories.