Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
 - type AuthzRepository
 - type Object
 - type Relation
 - type RelationType
 - type RelationV2
 - type Repository
 - type RoleService
 - type Service
 - func (s Service) CheckPermission(ctx context.Context, usr user.User, resourceNS namespace.Namespace, ...) (bool, error)
 - func (s Service) Create(ctx context.Context, rel RelationV2) (RelationV2, error)
 - func (s Service) Delete(ctx context.Context, rel Relation) error
 - func (s Service) DeleteSubjectRelations(ctx context.Context, resourceType, optionalResourceID string) error
 - func (s Service) DeleteV2(ctx context.Context, rel RelationV2) error
 - func (s Service) Get(ctx context.Context, id string) (RelationV2, error)
 - func (s Service) GetRelationByFields(ctx context.Context, rel RelationV2) (RelationV2, error)
 - func (s Service) List(ctx context.Context) ([]RelationV2, error)
 - func (s Service) Update(ctx context.Context, toUpdate Relation) (Relation, error)
 
- type Subject
 - type UserService
 
Constants ¶
This section is empty.
Variables ¶
      View Source
      
  
    var ( ErrNotExist = errors.New("relation doesn't exist") ErrInvalidUUID = errors.New("invalid syntax of uuid") ErrInvalidID = errors.New("relation id is invalid") ErrConflict = errors.New("relation already exist") ErrInvalidDetail = errors.New("invalid relation detail") ErrCreatingRelationInStore = errors.New("error while creating relation") ErrCreatingRelationInAuthzEngine = errors.New("error while creating relation in authz engine") ErrFetchingUser = errors.New("error while fetching user") )
      View Source
      
  
var RelationTypes = struct { Role RelationType Namespace RelationType }{ Role: "role", Namespace: "namespace", }
Functions ¶
This section is empty.
Types ¶
type AuthzRepository ¶
type AuthzRepository interface {
	Add(ctx context.Context, rel Relation) error
	Check(ctx context.Context, rel Relation, act action.Action) (bool, error)
	DeleteV2(ctx context.Context, rel RelationV2) error
	DeleteSubjectRelations(ctx context.Context, resourceType, optionalResourceID string) error
	AddV2(ctx context.Context, rel RelationV2) error
}
    type Relation ¶
type Relation struct {
	ID                 string
	SubjectNamespace   namespace.Namespace
	SubjectNamespaceID string `json:"subject_namespace_id"`
	SubjectID          string `json:"subject_id"`
	SubjectRoleID      string `json:"subject_role_id"`
	ObjectNamespace    namespace.Namespace
	ObjectNamespaceID  string `json:"object_namespace_id"`
	ObjectID           string `json:"object_id"`
	Role               role.Role
	RoleID             string       `json:"role_id"`
	RelationType       RelationType `json:"role_type"`
	CreatedAt          time.Time
	UpdatedAt          time.Time
}
    type RelationType ¶
type RelationType string
type RelationV2 ¶
type Repository ¶
type Repository interface {
	Get(ctx context.Context, id string) (RelationV2, error)
	Create(ctx context.Context, relation RelationV2) (RelationV2, error)
	List(ctx context.Context) ([]RelationV2, error)
	Update(ctx context.Context, toUpdate Relation) (Relation, error)
	DeleteByID(ctx context.Context, id string) error
	GetByFields(ctx context.Context, rel RelationV2) (RelationV2, error)
}
    type RoleService ¶
type Service ¶
type Service struct {
	// contains filtered or unexported fields
}
    func NewService ¶
func NewService(repository Repository, authzRepository AuthzRepository, roleService RoleService, userService UserService) *Service
func (Service) CheckPermission ¶
func (Service) Create ¶
func (s Service) Create(ctx context.Context, rel RelationV2) (RelationV2, error)
func (Service) DeleteSubjectRelations ¶
func (Service) GetRelationByFields ¶
func (s Service) GetRelationByFields(ctx context.Context, rel RelationV2) (RelationV2, error)
 Click to show internal directories. 
   Click to hide internal directories.