permissions

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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 Right struct {
	ID   primitive.ObjectID `bson:"_id,omitempty"`
	Name string             `bson:"name,omitempty"`
}

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)

func (*RightRepository) GetByName

func (r *RightRepository) GetByName(ctx context.Context, name string) (*Right, error)

func (*RightRepository) Update

func (r *RightRepository) Update(ctx context.Context, right *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) GetByName

func (s *RightService) GetByName(ctx context.Context, name string) (*Right, error)

func (*RightService) GetManyByIds

func (s *RightService) GetManyByIds(ctx context.Context, ids []primitive.ObjectID) ([]Right, error)

func (*RightService) GetRights

func (s *RightService) GetRights(ctx context.Context) ([]*Right, error)

func (*RightService) UpdateRight

func (s *RightService) UpdateRight(ctx context.Context, id primitive.ObjectID, name string) (*Right, error)

type Role

type Role struct {
	ID   primitive.ObjectID `bson:"_id,omitempty"`
	Name string             `bson:"name,omitempty"`
}

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)

func (*RoleRepository) GetByName

func (r *RoleRepository) GetByName(ctx context.Context, name string) (*Role, error)

func (*RoleRepository) Update

func (r *RoleRepository) Update(ctx context.Context, role *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)

func (*RoleService) GetById

func (s *RoleService) GetById(ctx context.Context, id primitive.ObjectID) (*Role, error)

func (*RoleService) GetByName

func (s *RoleService) GetByName(ctx context.Context, name string) (*Role, error)

func (*RoleService) GetRoles

func (s *RoleService) GetRoles(ctx context.Context) ([]*Role, error)

func (*RoleService) UpdateRole

func (s *RoleService) UpdateRole(ctx context.Context, id primitive.ObjectID, name string) (*Role, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL