Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterHandlers ¶
func RegisterHandlers(r *echo.Group, service Service)
Types ¶
type CreateUserRequest ¶
type CreateUserRequest struct { Username string `json:"username" bson:"username"` Identifier string `json:"identifier" bson:"identifier"` UserProperties map[string]interface{} `json:"user_properties" bson:"user_properties"` Roles []primitive.ObjectID `json:"roles,omitempty" bson:"roles"` Groups []primitive.ObjectID `json:"groups,omitempty" bson:"groups"` Policies []primitive.ObjectID `json:"policies,omitempty" bson:"policies"` }
func (CreateUserRequest) Validate ¶
func (m CreateUserRequest) 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 PatchUser ¶
type PatchUser struct { UserProperties map[string]interface{} `json:"user_properties,omitempty" bson:"user_properties"` AddedRoles []primitive.ObjectID `json:"added_roles,omitempty" bson:"added_roles"` RemovedRoles []primitive.ObjectID `json:"removed_roles,omitempty" bson:"removed_roles"` AddedGroups []primitive.ObjectID `json:"added_groups,omitempty" bson:"added_groups"` RemovedGroups []primitive.ObjectID `json:"removed_groups,omitempty" bson:"removed_groups"` AddedPolicies []primitive.ObjectID `json:"added_policies,omitempty" bson:"added_policies"` RemovedPolicies []primitive.ObjectID `json:"removed_policies,omitempty" bson:"removed_policies"` }
type PatchUserRequest ¶
type PatchUserRequest struct { UserProperties map[string]interface{} `json:"user_properties,omitempty" bson:"user_properties"` AddedRoles []primitive.ObjectID `json:"added_roles,omitempty" bson:"added_roles"` RemovedRoles []primitive.ObjectID `json:"removed_roles,omitempty" bson:"removed_roles"` AddedGroups []primitive.ObjectID `json:"added_groups,omitempty" bson:"added_groups"` RemovedGroups []primitive.ObjectID `json:"removed_groups,omitempty" bson:"removed_groups"` 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.User, error) GetIdByIdentifier(ctx context.Context, org_id string, identifier string) (string, error) Query(ctx context.Context, org_id string) (*[]mongo_entity.User, error) Create(ctx context.Context, org_id string, user mongo_entity.User) error Update(ctx context.Context, org_id string, id string, update_user UpdateUser) error Patch(ctx context.Context, org_id string, id string, req PatchUser) error Delete(ctx context.Context, org_id string, id string) error CheckUserExistById(ctx context.Context, org_id string, id string) (bool, error) CheckUserExistsByIdentifier(ctx context.Context, org_id string, key string) (bool, error) CheckRoleExistById(ctx context.Context, org_id string, id string) (bool, error) CheckRoleAlreadyAssignToUserById(ctx context.Context, org_id string, user_id string, role_id string) (bool, error) CheckGroupExistById(ctx context.Context, org_id string, id string) (bool, error) CheckGroupAlreadyAssignToUserById(ctx context.Context, org_id string, user_id string, group_id string) (bool, error) CheckPolicyExistById(ctx context.Context, org_id string, id string) (bool, error) CheckPolicyAlreadyAssignToUserById(ctx context.Context, org_id string, user_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) (User, error) GetIdByIdentifier(ctx context.Context, org_id string, identifier string) (string, error) Query(ctx context.Context, org_id string, filter Filter) ([]User, error) Create(ctx context.Context, org_id string, input CreateUserRequest) (User, error) Update(ctx context.Context, org_id string, id string, input UpdateUserRequest) (User, error) Patch(ctx context.Context, org_id string, id string, input PatchUserRequest) (User, error) Delete(ctx context.Context, org_id string, id string) error }
func NewService ¶
func NewService(repo Repository, logger *zap.Logger) Service
type UpdateUser ¶
type UpdateUser struct {
UserProperties map[string]interface{} `json:"user_properties" bson:"user_properties"`
}
type UpdateUserRequest ¶
type UpdateUserRequest struct {
UserProperties map[string]interface{} `json:"user_properties" bson:"user_properties"`
}
func (UpdateUserRequest) Validate ¶
func (m UpdateUserRequest) Validate() error
type User ¶
type User struct {
mongo_entity.User
}
Click to show internal directories.
Click to hide internal directories.