server

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeABAC

func MakeABAC(obj interface{}) (string, error)

Types

type AbacAttrList

type AbacAttrList struct {
	V0  string
	V1  string
	V2  string
	V3  string
	V4  string
	V5  string
	V6  string
	V7  string
	V8  string
	V9  string
	V10 string
	// contains filtered or unexported fields
}

func (AbacAttrList) GetCacheKey

func (attr AbacAttrList) GetCacheKey() string

type Config

type Config struct {
	Driver      string
	Connection  string
	Enforcer    string
	DBSpecified bool
}

func LoadConfiguration

func LoadConfiguration(file string) (*Config, error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is used to implement proto.CasbinServer.

func NewServer

func NewServer() *Server

func (*Server) AddGroupingPolicy

func (s *Server) AddGroupingPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, 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(_ context.Context, in *pb.PolicyRequest) (*pb.BoolReply, 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 (s *Server) AddNamedPolicy(_ context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error)

func (*Server) AddPermissionForUser

func (s *Server) AddPermissionForUser(_ context.Context, in *pb.PermissionRequest) (*pb.BoolReply, 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) AddPolicy

func (s *Server) AddPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error)

func (*Server) AddRoleForUser

func (s *Server) AddRoleForUser(_ context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, 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(_ context.Context, in *pb.PermissionRequest) (*pb.BoolReply, error)

DeletePermission deletes a permission. Returns false if the permission does not exist (aka not affected).

func (*Server) DeletePermissionForUser

func (s *Server) DeletePermissionForUser(_ context.Context, in *pb.PermissionRequest) (*pb.BoolReply, 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(_ context.Context, in *pb.PermissionRequest) (*pb.BoolReply, 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(_ context.Context, in *pb.UserRoleRequest) (*pb.EmptyReply, error)

DeleteRole deletes a role.

func (*Server) DeleteRoleForUser

func (s *Server) DeleteRoleForUser(_ context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, 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(_ context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, 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(_ context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error)

DeleteUser deletes a user. Returns false if the user does not exist (aka not affected).

func (*Server) Enforce

func (s *Server) Enforce(_ context.Context, in *pb.EnforceRequest) (*pb.BoolReply, error)

func (*Server) GetAllActions

func (s *Server) GetAllActions(ctx context.Context, in *pb.EmptyRequest) (*pb.ArrayReply, error)

GetAllActions gets the list of actions that show up in the current policy.

func (*Server) GetAllNamedActions

func (s *Server) GetAllNamedActions(_ context.Context, in *pb.SimpleGetRequest) (*pb.ArrayReply, error)

GetAllNamedActions gets the list of actions that show up in the current named policy.

func (*Server) GetAllNamedObjects

func (s *Server) GetAllNamedObjects(_ context.Context, in *pb.SimpleGetRequest) (*pb.ArrayReply, error)

GetAllNamedObjects gets the list of objects that show up in the current named policy.

func (*Server) GetAllNamedRoles

func (s *Server) GetAllNamedRoles(_ context.Context, in *pb.SimpleGetRequest) (*pb.ArrayReply, error)

GetAllNamedRoles gets the list of roles that show up in the current named policy.

func (*Server) GetAllNamedSubjects

func (s *Server) GetAllNamedSubjects(_ context.Context, in *pb.SimpleGetRequest) (*pb.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, in *pb.EmptyRequest) (*pb.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, in *pb.EmptyRequest) (*pb.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, in *pb.EmptyRequest) (*pb.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, in *pb.FilteredPolicyRequest) (*pb.Array2DReply, error)

GetFilteredGroupingPolicy gets all the role inheritance rules in the policy, field filters can be specified.

func (*Server) GetFilteredNamedGroupingPolicy

func (s *Server) GetFilteredNamedGroupingPolicy(_ context.Context, in *pb.FilteredPolicyRequest) (*pb.Array2DReply, error)

GetFilteredNamedGroupingPolicy gets all the role inheritance rules in the policy, field filters can be specified.

func (*Server) GetFilteredNamedPolicy

func (s *Server) GetFilteredNamedPolicy(_ context.Context, in *pb.FilteredPolicyRequest) (*pb.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, in *pb.FilteredPolicyRequest) (*pb.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, in *pb.EmptyRequest) (*pb.Array2DReply, error)

GetGroupingPolicy gets all the role inheritance rules in the policy.

func (*Server) GetImplicitPermissionsForUser

func (s *Server) GetImplicitPermissionsForUser(_ context.Context, in *pb.PermissionRequest) (*pb.Array2DReply, error)

GetImplicitPermissionsForUser gets all permissions(including children) for a user or role.

func (*Server) GetImplicitRolesForUser

func (s *Server) GetImplicitRolesForUser(_ context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error)

GetImplicitRolesForUser gets implicit roles that a user has.

func (*Server) GetNamedGroupingPolicy

func (s *Server) GetNamedGroupingPolicy(_ context.Context, in *pb.PolicyRequest) (*pb.Array2DReply, error)

GetNamedGroupingPolicy gets all the role inheritance rules in the policy.

func (*Server) GetNamedPolicy

func (s *Server) GetNamedPolicy(_ context.Context, in *pb.PolicyRequest) (*pb.Array2DReply, error)

GetNamedPolicy gets all the authorization rules in the named policy.

func (*Server) GetPermissionsForUser

func (s *Server) GetPermissionsForUser(_ context.Context, in *pb.PermissionRequest) (*pb.Array2DReply, error)

GetPermissionsForUser gets permissions for a user or role.

func (*Server) GetPolicy

func (s *Server) GetPolicy(ctx context.Context, in *pb.EmptyRequest) (*pb.Array2DReply, error)

GetPolicy gets all the authorization rules in the policy.

func (*Server) GetRolesForUser

func (s *Server) GetRolesForUser(_ context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error)

GetRolesForUser gets the roles that a user has.

func (*Server) GetUsersForRole

func (s *Server) GetUsersForRole(_ context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error)

GetUsersForRole gets the users that have a role.

func (*Server) HasGroupingPolicy

func (s *Server) HasGroupingPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error)

HasGroupingPolicy determines whether a role inheritance rule exists.

func (*Server) HasNamedGroupingPolicy

func (s *Server) HasNamedGroupingPolicy(_ context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error)

HasNamedGroupingPolicy determines whether a named role inheritance rule exists.

func (*Server) HasNamedPolicy

func (s *Server) HasNamedPolicy(_ context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error)

HasNamedPolicy determines whether a named authorization rule exists.

func (*Server) HasPermissionForUser

func (s *Server) HasPermissionForUser(_ context.Context, in *pb.PermissionRequest) (*pb.BoolReply, error)

HasPermissionForUser determines whether a user has a permission.

func (*Server) HasPolicy

func (s *Server) HasPolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error)

HasPolicy determines whether an authorization rule exists.

func (*Server) HasRoleForUser

func (s *Server) HasRoleForUser(_ context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error)

HasRoleForUser determines whether a user has a role.

func (*Server) LoadPolicy

func (s *Server) LoadPolicy(_ context.Context, in *pb.EmptyRequest) (*pb.EmptyReply, error)

func (*Server) NewAdapter

func (s *Server) NewAdapter(_ context.Context, in *pb.NewAdapterRequest) (*pb.NewAdapterReply, error)

func (*Server) NewEnforcer

func (s *Server) NewEnforcer(_ context.Context, in *pb.NewEnforcerRequest) (*pb.NewEnforcerReply, error)

func (*Server) RemoveFilteredGroupingPolicy

func (s *Server) RemoveFilteredGroupingPolicy(ctx context.Context, in *pb.FilteredPolicyRequest) (*pb.BoolReply, error)

RemoveFilteredGroupingPolicy removes a role inheritance rule from the current policy, field filters can be specified.

func (*Server) RemoveFilteredNamedGroupingPolicy

func (s *Server) RemoveFilteredNamedGroupingPolicy(_ context.Context, in *pb.FilteredPolicyRequest) (*pb.BoolReply, error)

RemoveFilteredNamedGroupingPolicy removes a role inheritance rule from the current named policy, field filters can be specified.

func (*Server) RemoveFilteredNamedPolicy

func (s *Server) RemoveFilteredNamedPolicy(_ context.Context, in *pb.FilteredPolicyRequest) (*pb.BoolReply, 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, in *pb.FilteredPolicyRequest) (*pb.BoolReply, 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, in *pb.PolicyRequest) (*pb.BoolReply, error)

RemoveGroupingPolicy removes a role inheritance rule from the current policy.

func (*Server) RemoveNamedGroupingPolicy

func (s *Server) RemoveNamedGroupingPolicy(_ context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error)

RemoveNamedGroupingPolicy removes a role inheritance rule from the current named policy.

func (*Server) RemoveNamedPolicy

func (s *Server) RemoveNamedPolicy(_ context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error)

func (*Server) RemovePolicy

func (s *Server) RemovePolicy(ctx context.Context, in *pb.PolicyRequest) (*pb.BoolReply, error)

func (*Server) SavePolicy

func (s *Server) SavePolicy(_ context.Context, in *pb.EmptyRequest) (*pb.EmptyReply, error)

Jump to

Keyboard shortcuts

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