Documentation ¶
Index ¶
- type PermissionHandlers
- func (h *PermissionHandlers) CreateRight(c *gin.Context)
- func (h *PermissionHandlers) CreateRole(c *gin.Context)
- func (h *PermissionHandlers) GetRights(c *gin.Context)
- func (h *PermissionHandlers) GetRoles(c *gin.Context)
- func (h *PermissionHandlers) UpdateRight(c *gin.Context)
- func (h *PermissionHandlers) UpdateRole(c *gin.Context)
- type Right
- type RightRepository
- type RightService
- func (s *RightService) CreateRight(ctx context.Context, payload payloads.CreateRightPayload) (*Right, error)
- func (s *RightService) GetByName(ctx context.Context, name string) (*Right, error)
- func (s *RightService) GetManyByIds(ctx context.Context, ids []primitive.ObjectID) ([]Right, error)
- func (s *RightService) GetRights(ctx context.Context) ([]*Right, error)
- func (s *RightService) UpdateRight(ctx context.Context, id primitive.ObjectID, name string) (*Right, error)
- type Role
- type RoleRepository
- type RoleService
- func (s *RoleService) CreateRole(ctx context.Context, payload payloads.CreateRolePayload) (*Role, error)
- func (s *RoleService) GetById(ctx context.Context, id primitive.ObjectID) (*Role, error)
- func (s *RoleService) GetByName(ctx context.Context, name string) (*Role, error)
- func (s *RoleService) GetRoles(ctx context.Context) ([]*Role, error)
- func (s *RoleService) UpdateRole(ctx context.Context, id primitive.ObjectID, name string) (*Role, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PermissionHandlers ¶
type PermissionHandlers struct {
// contains filtered or unexported fields
}
func NewPermissionHandlers ¶
func NewPermissionHandlers(roleService *RoleService, rightService *RightService, log *zap.Logger, blunder *blunder.Blunder) *PermissionHandlers
func (*PermissionHandlers) CreateRight ¶
func (h *PermissionHandlers) CreateRight(c *gin.Context)
CreateRightHandler godoc @Summary Create right @Description create right @Tags identity @Accept json @Produce json @Security OAuth2Application @Param data body CreateRightPayload true "data" @Router /rights [post]
func (*PermissionHandlers) CreateRole ¶
func (h *PermissionHandlers) CreateRole(c *gin.Context)
CreateRoleHandler godoc @Summary Create role @Description create role @Tags identity @Accept json @Produce json @Security OAuth2Application @Param data body CreateRolePayload true "data" @Router /roles [post]
func (*PermissionHandlers) GetRights ¶
func (h *PermissionHandlers) GetRights(c *gin.Context)
GetRightsHandler godoc @Summary Get rights @Description get rights @Tags identity @Accept json @Produce json @Security OAuth2Application @Success 200 {array} RightResponse @Router /rights [get]
func (*PermissionHandlers) GetRoles ¶
func (h *PermissionHandlers) GetRoles(c *gin.Context)
GetRolesHandler godoc @Summary Get roles @Description get roles @Tags identity @Accept json @Produce json @Security OAuth2Application @Success 200 {array} RoleResponse @Router /roles [get]
func (*PermissionHandlers) UpdateRight ¶
func (h *PermissionHandlers) UpdateRight(c *gin.Context)
UpdateRoleHandler godoc @Summary Update role @Description update role @Tags identity @Accept json @Produce json @Security OAuth2Application @Param rightID path string true "1" @Param data body UpdateRightPayload true "data" @Success 200 {object} RightResponse @Router /rights/{rightId} [put]
func (*PermissionHandlers) UpdateRole ¶
func (h *PermissionHandlers) UpdateRole(c *gin.Context)
UpdateRoleHandler godoc @Summary Update role @Description update role @Tags identity @Accept json @Produce json @Security OAuth2Application @Param roleID path string true "1" @Param data body UpdateRolePayload true "data" @Success 200 {object} RoleResponse @Router /roles/{roleId} [put]
type RightRepository ¶
type RightRepository struct {
*passport.MongoRepository
}
func NewRightRepository ¶
func NewRightRepository(client *mongo.Client, conf *passport.Config) *RightRepository
func (*RightRepository) GetAll ¶
func (r *RightRepository) GetAll(ctx context.Context) ([]*Right, error)
type RightService ¶
type RightService struct {
// contains filtered or unexported fields
}
func NewRightService ¶
func NewRightService(repository *RightRepository, conf *passport.Config, log *zap.Logger) *RightService
func (*RightService) CreateRight ¶
func (s *RightService) CreateRight(ctx context.Context, payload payloads.CreateRightPayload) (*Right, error)
func (*RightService) GetManyByIds ¶
func (*RightService) GetRights ¶
func (s *RightService) GetRights(ctx context.Context) ([]*Right, error)
func (*RightService) UpdateRight ¶
type RoleRepository ¶
type RoleRepository struct {
*passport.MongoRepository
}
func NewRoleRepository ¶
func NewRoleRepository(client *mongo.Client, conf *passport.Config) *RoleRepository
func (*RoleRepository) GetAll ¶
func (r *RoleRepository) GetAll(ctx context.Context) ([]*Role, error)
type RoleService ¶
type RoleService struct {
// contains filtered or unexported fields
}
func NewRoleService ¶
func NewRoleService(repository *RoleRepository) *RoleService
func (*RoleService) CreateRole ¶
func (s *RoleService) CreateRole(ctx context.Context, payload payloads.CreateRolePayload) (*Role, error)