Documentation ¶
Index ¶
Constants ¶
View Source
const RoleAnonymous = "anonymous"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataSource ¶
type DataSource interface { GetRoleAll() ([]Roles, error) GetRoleById(id string) (Roles, error) AddRole(data *Roles) error UpdateRole(data Roles) error DeleteRole(id string) error CheckRoleDisplayExist(display string) Roles GetRoleUserAll() ([]RoleUser, error) GetRoleUserById(id string) (RoleUser, error) GetRoleUserByRoleId(id string) (RoleUser, error) AddRoleUser(data *RoleUser) error UpdateRoleUser(data RoleUser) error DeleteRoleUser(id string) error RoleUserExist(data RoleUser) bool GetPolicyAll() ([]Policy, error) GetPolicyById(id string) (Policy, error) GetPolicyByRoleId(id string) (Policy, error) GetPolicyListByRoleId(id string) ([]Policy, error) UpdatePolicy(data Policy) error PolicyExist(data Policy) bool }
DataSource is the interface
func NewDataSource ¶
func NewDataSource(mgoDb *mongo.Database) DataSource
NewDataSource new instance
type Handler ¶
type Handler interface { GetRoleByID(c *fiber.Ctx) error GetRoleList(c *fiber.Ctx) error CreateRole(c *fiber.Ctx) error UpdateRole(c *fiber.Ctx) error DeleteRole(c *fiber.Ctx) error GetRoleUserByID(c *fiber.Ctx) error GetRoleUserList(c *fiber.Ctx) error CreateRoleUser(c *fiber.Ctx) error UpdateRoleUser(c *fiber.Ctx) error DeleteRoleUser(c *fiber.Ctx) error GetPolicyByID(c *fiber.Ctx) error GetPolicyListByRoleId(c *fiber.Ctx) error GetPolicyList(c *fiber.Ctx) error CreatePolicy(c *fiber.Ctx) error UpdatePolicy(c *fiber.Ctx) error DeletePolicy(c *fiber.Ctx) error }
Handler is the interface
type Policy ¶
type Policy struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` Policy string `json:"-" bson:"ptype"` RoleId string `json:"roleId" bson:"v0"` Path string `json:"path" bson:"v1"` Method string `json:"method" bson:"v2"` V3 string `json:"v3" bson:"v3"` V4 string `json:"v4" bson:"v4"` V5 string `json:"v5" bson:"v5"` }
Policy a model
type Repository ¶
type Repository interface { GetRoleAll() ([]Roles, error) GetRoleById(id string) (Roles, error) AddRole(data *Roles) error UpdateRole(data Roles) error DeleteRole(id string) error CheckRoleDisplayExist(display string) Roles GetRoleUserAll() ([]RoleUser, error) GetRoleUserById(id string) (RoleUser, error) AddRoleUser(data *RoleUser) error UpdateRoleUser(data RoleUser) error DeleteRoleUser(id string) error RoleUserExist(data RoleUser) bool GetPolicyAll() ([]Policy, error) GetPolicyById(id string) (Policy, error) GetPolicyListByRoleId(id string) ([]Policy, error) AddPolicy(data *Policy) error UpdatePolicy(data Policy) error DeletePolicy(id string) error PolicyExist(data Policy) bool }
Repository is a interface
func NewRepository ¶
func NewRepository(enforcer *casbin.Enforcer, source DataSource) Repository
NewRepository new instance
type RoleUser ¶
type RoleUser struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` UserID int `json:"userId" bson:"userId"` RoleID string `json:"roleId" bson:"roleId"` }
RoleUser a model
type Roles ¶
type Roles struct { ID primitive.ObjectID `json:"id" bson:"_id,omitempty"` Display string `json:"display"` Description string `json:"description"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
Roles a model
type UseCase ¶
type UseCase interface { GetRoleAll() ([]Roles, error) GetRoleById(id string) (Roles, error) AddRole(data *Roles) error UpdateRole(data Roles) error DeleteRole(id string) error CheckRoleDisplayExist(display string) Roles GetRoleUserAll() ([]RoleUser, error) GetRoleUserById(id string) (RoleUser, error) AddRoleUser(data *RoleUser) error UpdateRoleUser(data RoleUser) error DeleteRoleUser(id string) error RoleUserExist(data RoleUser) bool GetPolicyAll() ([]Policy, error) GetPolicyById(id string) (Policy, error) GetPolicyListByRoleId(id string) ([]Policy, error) AddPolicy(data *Policy) error UpdatePolicy(data Policy) error DeletePolicy(id string) error PolicyExist(data Policy) bool }
UseCase is the interface
Click to show internal directories.
Click to hide internal directories.