Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandlers ¶
func RegisterHandlers(r *echo.Group, service Service)
Types ¶
type CreateGroupRequest ¶
type CreateGroupRequest struct { Identifier string `json:"identifier" bson:"identifier"` DisplayName string `json:"display_name" bson:"display_name"` Roles []primitive.ObjectID `json:"roles,omitempty" bson:"roles"` Users []primitive.ObjectID `json:"users,omitempty" bson:"users"` Policies []primitive.ObjectID `json:"policies,omitempty" bson:"policies"` }
func (CreateGroupRequest) Validate ¶
func (m CreateGroupRequest) Validate() error
type Filter ¶
type Filter struct { Cursor int `json:"cursor" query:"cursor"` Limit int `json:"limit" query:"limit"` Name string `json:"name" query:"name"` }
Pagination filter.
type Group ¶
type Group struct {
mongo_entity.Group
}
type PatchGroup ¶
type PatchGroup struct { AddedRoles []primitive.ObjectID `json:"added_roles,omitempty" bson:"added_roles"` RemovedRoles []primitive.ObjectID `json:"removed_roles,omitempty" bson:"removed_roles"` AddedUsers []primitive.ObjectID `json:"added_users,omitempty" bson:"added_users"` RemovedUsers []primitive.ObjectID `json:"removed_users,omitempty" bson:"removed_users"` AddedPolicies []primitive.ObjectID `json:"added_policies,omitempty" bson:"added_policies"` RemovedPolicies []primitive.ObjectID `json:"removed_policies,omitempty" bson:"removed_policies"` }
type PatchGroupRequest ¶
type PatchGroupRequest struct { AddedRoles []primitive.ObjectID `json:"added_roles,omitempty" bson:"added_roles"` RemovedRoles []primitive.ObjectID `json:"removed_roles,omitempty" bson:"removed_roles"` AddedUsers []primitive.ObjectID `json:"added_users,omitempty" bson:"added_users"` RemovedUsers []primitive.ObjectID `json:"removed_users,omitempty" bson:"removed_users"` AddedPolicies []primitive.ObjectID `json:"added_policies,omitempty" bson:"added_policies"` RemovedPolicies []primitive.ObjectID `json:"removed_policies,omitempty" bson:"removed_policies"` }
type Repository ¶
type Repository interface { Get(ctx context.Context, org_id string, id string) (*mongo_entity.Group, error) Query(ctx context.Context, org_id string) (*[]mongo_entity.Group, error) Create(ctx context.Context, org_id string, group mongo_entity.Group) error Update(ctx context.Context, org_id string, id string, update_group UpdateGroup) error Patch(ctx context.Context, org_id string, id string, patch_group PatchGroup) error Delete(ctx context.Context, org_id string, id string) error CheckGroupExistById(ctx context.Context, org_id string, id string) (bool, error) CheckGroupExistsByIdentifier(ctx context.Context, org_id string, key string) (bool, error) CheckRoleExistById(ctx context.Context, org_id string, id string) (bool, error) CheckRoleAlreadyAssignToGroupById(ctx context.Context, org_id string, group_id string, role_id string) (bool, error) CheckUserExistById(ctx context.Context, org_id string, id string) (bool, error) CheckUserAlreadyAssignToGroupById(ctx context.Context, org_id string, group_id string, user_id string) (bool, error) CheckPolicyExistById(ctx context.Context, org_id string, id string) (bool, error) CheckPolicyAlreadyAssignToGroupById(ctx context.Context, org_id string, group_id string, policy_id string) (bool, error) }
func NewRepository ¶
func NewRepository(mongodb *db.MongoDB) Repository
type Service ¶
type Service interface { Get(ctx context.Context, org_id string, id string) (Group, error) Query(ctx context.Context, org_id string, filter Filter) ([]Group, error) Create(ctx context.Context, org_id string, input CreateGroupRequest) (Group, error) Update(ctx context.Context, org_id string, id string, input UpdateGroupRequest) (Group, error) Delete(ctx context.Context, org_id string, id string) error Patch(ctx context.Context, org_id string, id string, input PatchGroupRequest) (Group, error) }
func NewService ¶
func NewService(repo Repository, logger *zap.Logger) Service
type UpdateGroup ¶
type UpdateGroup struct {
DisplayName *string `json:"display_name,omitempty" bson:"display_name"`
}
type UpdateGroupRequest ¶
type UpdateGroupRequest struct {
DisplayName *string `json:"display_name,omitempty" bson:"display_name"`
}
func (UpdateGroupRequest) Validate ¶
func (m UpdateGroupRequest) Validate() error
Click to show internal directories.
Click to hide internal directories.