Documentation ¶
Index ¶
- Constants
- Variables
- func MakeABAC(obj interface{}) (string, error)
- type AbacAttrList
- type CasbinMicro
- type Config
- type Server
- func (s *Server) AddGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) AddNamedGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) AddNamedPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) AddPermissionForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
- func (s *Server) AddPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) AddRoleForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
- func (s *Server) DeletePermission(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
- func (s *Server) DeletePermissionForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
- func (s *Server) DeletePermissionsForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
- func (s *Server) DeleteRole(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
- func (s *Server) DeleteRoleForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
- func (s *Server) DeleteRolesForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
- func (s *Server) DeleteUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
- func (s *Server) Enforce(ctx context.Context, req *casbinpb.EnforceRequest, rsp *casbinpb.Empty) error
- func (s *Server) GetAllActions(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetAllNamedActions(ctx context.Context, req *casbinpb.SimpleGetRequest, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetAllNamedObjects(ctx context.Context, req *casbinpb.SimpleGetRequest, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetAllNamedRoles(ctx context.Context, req *casbinpb.SimpleGetRequest, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetAllNamedSubjects(ctx context.Context, req *casbinpb.SimpleGetRequest, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetAllObjects(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetAllRoles(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetAllSubjects(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetFilteredGroupingPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, ...) error
- func (s *Server) GetFilteredNamedGroupingPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, ...) error
- func (s *Server) GetFilteredNamedPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, ...) error
- func (s *Server) GetFilteredPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, ...) error
- func (s *Server) GetGroupingPolicy(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.Array2DReply) error
- func (s *Server) GetImplicitPermissionsForUser(ctx context.Context, req *casbinpb.PermissionRequest, ...) error
- func (s *Server) GetImplicitRolesForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetNamedGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Array2DReply) error
- func (s *Server) GetNamedPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Array2DReply) error
- func (s *Server) GetPermissionsForUser(ctx context.Context, req *casbinpb.PermissionRequest, ...) error
- func (s *Server) GetPolicy(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.Array2DReply) error
- func (s *Server) GetRolesForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.ArrayReply) error
- func (s *Server) GetUsersForRole(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.ArrayReply) error
- func (s *Server) HasGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) HasNamedGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) HasNamedPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) HasPermissionForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
- func (s *Server) HasPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) HasRoleForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
- func (s *Server) ImportPolicy(ctx context.Context, req *casbinpb.ImportPolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) LoadPolicy(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.Empty) error
- func (s *Server) LoadPolicyFile(path string) error
- func (s *Server) LoadPolicyReader(r io.Reader) error
- func (s *Server) RemoveFilteredGroupingPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) RemoveFilteredNamedGroupingPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) RemoveFilteredNamedPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) RemoveFilteredPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) RemoveGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) RemoveNamedGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) RemoveNamedPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) RemovePolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
- func (s *Server) SavePolicy(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.Empty) error
Constants ¶
const ( Prefix = "internal.server" UnmarshalKey = "server" )
Variables ¶
Functions ¶
Types ¶
type AbacAttrList ¶
type CasbinMicro ¶
func New ¶
func New(ctx context.Context, set provider.AwareSet, srv *micro.Micro, cfg *Config, globalCfg *glbConfig.Config) *CasbinMicro
New
func Provider ¶
func Provider(ctx context.Context, set provider.AwareSet, srv *micro.Micro, cfg *Config, globalCfg *glbConfig.Config) (*CasbinMicro, func(), error)
Provider
func (*CasbinMicro) ListenAndServe ¶
func (c *CasbinMicro) ListenAndServe() (err error)
ListenAndServe
type Config ¶
type Config struct { Debug bool `fallback:"shared.debug"` WorkDir string // contains filtered or unexported fields }
Config
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AddGroupingPolicy ¶
func (s *Server) AddGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
AddGroupingPolicy adds a role inheritance rule to the current policy. If the rule already exists, the function returns false and the rule will not be added. Otherwise the function returns true by adding the new rule.
func (*Server) AddNamedGroupingPolicy ¶
func (s *Server) AddNamedGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
AddNamedGroupingPolicy adds a named role inheritance rule to the current policy. If the rule already exists, the function returns false and the rule will not be added. Otherwise the function returns true by adding the new rule.
func (*Server) AddNamedPolicy ¶
func (*Server) AddPermissionForUser ¶
func (s *Server) AddPermissionForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
AddPermissionForUser adds a permission for a user or role. Returns false if the user or role already has the permission (aka not affected).
func (*Server) AddRoleForUser ¶
func (s *Server) AddRoleForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
AddRoleForUser adds a role for a user. Returns false if the user already has the role (aka not affected).
func (*Server) DeletePermission ¶
func (s *Server) DeletePermission(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
DeletePermission deletes a permission. Returns false if the permission does not exist (aka not affected).
func (*Server) DeletePermissionForUser ¶
func (s *Server) DeletePermissionForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
DeletePermissionForUser deletes a permission for a user or role. Returns false if the user or role does not have the permission (aka not affected).
func (*Server) DeletePermissionsForUser ¶
func (s *Server) DeletePermissionsForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
DeletePermissionsForUser deletes permissions for a user or role. Returns false if the user or role does not have any permissions (aka not affected).
func (*Server) DeleteRole ¶
func (s *Server) DeleteRole(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
DeleteRole deletes a role.
func (*Server) DeleteRoleForUser ¶
func (s *Server) DeleteRoleForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
DeleteRoleForUser deletes a role for a user. Returns false if the user does not have the role (aka not affected).
func (*Server) DeleteRolesForUser ¶
func (s *Server) DeleteRolesForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
DeleteRolesForUser deletes all roles for a user. Returns false if the user does not have any roles (aka not affected).
func (*Server) DeleteUser ¶
func (s *Server) DeleteUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
DeleteUser deletes a user. Returns false if the user does not exist (aka not affected).
func (*Server) GetAllActions ¶
func (s *Server) GetAllActions(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.ArrayReply) error
GetAllActions gets the list of actions that show up in the current policy.
func (*Server) GetAllNamedActions ¶
func (s *Server) GetAllNamedActions(ctx context.Context, req *casbinpb.SimpleGetRequest, rsp *casbinpb.ArrayReply) error
GetAllNamedActions gets the list of actions that show up in the current named policy.
func (*Server) GetAllNamedObjects ¶
func (s *Server) GetAllNamedObjects(ctx context.Context, req *casbinpb.SimpleGetRequest, rsp *casbinpb.ArrayReply) error
GetAllNamedObjects gets the list of objects that show up in the current named policy.
func (*Server) GetAllNamedRoles ¶
func (s *Server) GetAllNamedRoles(ctx context.Context, req *casbinpb.SimpleGetRequest, rsp *casbinpb.ArrayReply) error
GetAllNamedRoles gets the list of roles that show up in the current named policy.
func (*Server) GetAllNamedSubjects ¶
func (s *Server) GetAllNamedSubjects(ctx context.Context, req *casbinpb.SimpleGetRequest, rsp *casbinpb.ArrayReply) error
GetAllNamedSubjects gets the list of subjects that show up in the current named policy.
func (*Server) GetAllObjects ¶
func (s *Server) GetAllObjects(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.ArrayReply) error
GetAllObjects gets the list of objects that show up in the current policy.
func (*Server) GetAllRoles ¶
func (s *Server) GetAllRoles(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.ArrayReply) error
GetAllRoles gets the list of roles that show up in the current policy.
func (*Server) GetAllSubjects ¶
func (s *Server) GetAllSubjects(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.ArrayReply) error
GetAllSubjects gets the list of subjects that show up in the current policy.
func (*Server) GetFilteredGroupingPolicy ¶
func (s *Server) GetFilteredGroupingPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Array2DReply) error
GetFilteredGroupingPolicy gets all the role inheritance rules in the policy, field filters can be specified.
func (*Server) GetFilteredNamedGroupingPolicy ¶
func (s *Server) GetFilteredNamedGroupingPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Array2DReply) error
GetFilteredNamedGroupingPolicy gets all the role inheritance rules in the policy, field filters can be specified.
func (*Server) GetFilteredNamedPolicy ¶
func (s *Server) GetFilteredNamedPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Array2DReply) error
GetFilteredNamedPolicy gets all the authorization rules in the named policy, field filters can be specified.
func (*Server) GetFilteredPolicy ¶
func (s *Server) GetFilteredPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Array2DReply) error
GetFilteredPolicy gets all the authorization rules in the policy, field filters can be specified.
func (*Server) GetGroupingPolicy ¶
func (s *Server) GetGroupingPolicy(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.Array2DReply) error
GetGroupingPolicy gets all the role inheritance rules in the policy.
func (*Server) GetImplicitPermissionsForUser ¶
func (s *Server) GetImplicitPermissionsForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Array2DReply) error
GetImplicitPermissionsForUser gets implicit permissions for a user or role
func (*Server) GetImplicitRolesForUser ¶
func (s *Server) GetImplicitRolesForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.ArrayReply) error
GetImplicitRolesForUser gets implicit roles for user
func (*Server) GetNamedGroupingPolicy ¶
func (s *Server) GetNamedGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Array2DReply) error
GetNamedGroupingPolicy gets all the role inheritance rules in the policy.
func (*Server) GetNamedPolicy ¶
func (s *Server) GetNamedPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Array2DReply) error
GetNamedPolicy gets all the authorization rules in the named policy.
func (*Server) GetPermissionsForUser ¶
func (s *Server) GetPermissionsForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Array2DReply) error
GetPermissionsForUser gets permissions for a user or role.
func (*Server) GetPolicy ¶
func (s *Server) GetPolicy(ctx context.Context, req *casbinpb.Empty, rsp *casbinpb.Array2DReply) error
GetPolicy gets all the authorization rules in the policy.
func (*Server) GetRolesForUser ¶
func (s *Server) GetRolesForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.ArrayReply) error
GetRolesForUser gets the roles that a user has.
func (*Server) GetUsersForRole ¶
func (s *Server) GetUsersForRole(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.ArrayReply) error
GetUsersForRole gets the users that has a role.
func (*Server) HasGroupingPolicy ¶
func (s *Server) HasGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
HasGroupingPolicy determines whether a role inheritance rule exists.
func (*Server) HasNamedGroupingPolicy ¶
func (s *Server) HasNamedGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
HasNamedGroupingPolicy determines whether a named role inheritance rule exists.
func (*Server) HasNamedPolicy ¶
func (s *Server) HasNamedPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
HasNamedPolicy determines whether a named authorization rule exists.
func (*Server) HasPermissionForUser ¶
func (s *Server) HasPermissionForUser(ctx context.Context, req *casbinpb.PermissionRequest, rsp *casbinpb.Empty) error
HasPermissionForUser determines whether a user has a permission.
func (*Server) HasPolicy ¶
func (s *Server) HasPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
HasPolicy determines whether an authorization rule exists.
func (*Server) HasRoleForUser ¶
func (s *Server) HasRoleForUser(ctx context.Context, req *casbinpb.UserRoleRequest, rsp *casbinpb.Empty) error
HasRoleForUser determines whether a user has a role.
func (*Server) ImportPolicy ¶
func (*Server) LoadPolicy ¶
func (*Server) LoadPolicyFile ¶
func (*Server) RemoveFilteredGroupingPolicy ¶
func (s *Server) RemoveFilteredGroupingPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Empty) error
RemoveFilteredGroupingPolicy removes a role inheritance rule from the current policy, field filters can be specified.
func (*Server) RemoveFilteredNamedGroupingPolicy ¶
func (s *Server) RemoveFilteredNamedGroupingPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Empty) error
RemoveFilteredNamedGroupingPolicy removes a role inheritance rule from the current named policy, field filters can be specified.
func (*Server) RemoveFilteredNamedPolicy ¶
func (s *Server) RemoveFilteredNamedPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Empty) error
RemoveFilteredNamedPolicy removes an authorization rule from the current named policy, field filters can be specified.
func (*Server) RemoveFilteredPolicy ¶
func (s *Server) RemoveFilteredPolicy(ctx context.Context, req *casbinpb.FilteredPolicyRequest, rsp *casbinpb.Empty) error
RemoveFilteredPolicy removes an authorization rule from the current policy, field filters can be specified.
func (*Server) RemoveGroupingPolicy ¶
func (s *Server) RemoveGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
RemoveGroupingPolicy removes a role inheritance rule from the current policy.
func (*Server) RemoveNamedGroupingPolicy ¶
func (s *Server) RemoveNamedGroupingPolicy(ctx context.Context, req *casbinpb.PolicyRequest, rsp *casbinpb.Empty) error
RemoveNamedGroupingPolicy removes a role inheritance rule from the current named policy.