Documentation ¶
Overview ¶
Package permission handles API calls and persistence for spaces. Spaces in Documize contain documents.
Index ¶
- func CanChangeDocument(ctx domain.RequestContext, s domain.Store, documentID string) bool
- func CanDeleteDocument(ctx domain.RequestContext, s domain.Store, documentID string) bool
- func CanManageVersion(ctx domain.RequestContext, s domain.Store, spaceID string) bool
- func CanUploadDocument(ctx domain.RequestContext, s domain.Store, spaceID string) bool
- func CanViewDocument(ctx domain.RequestContext, s domain.Store, documentID string) bool
- func CanViewDrafts(ctx domain.RequestContext, s domain.Store, spaceID string) bool
- func CanViewSpace(ctx domain.RequestContext, s domain.Store, spaceID string) bool
- func CanViewSpaceDocument(ctx domain.RequestContext, s domain.Store, labelID string) bool
- func CheckPermission(ctx domain.RequestContext, s domain.Store, spaceID string, userID string, ...) bool
- func GetUsersWithDocumentPermission(ctx domain.RequestContext, s domain.Store, spaceID, documentID string, ...) (users []u.User, err error)
- func HasPermission(ctx domain.RequestContext, s domain.Store, spaceID string, ...) bool
- type Handler
- func (h *Handler) GetCategoryPermissions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetCategoryViewers(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetDocumentPermissions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetSpacePermissions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetUserDocumentPermissions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetUserSpacePermissions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SetCategoryPermissions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SetDocumentPermissions(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SetSpacePermissions(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanChangeDocument ¶
CanChangeDocument returns if the clinet has permission to change a given document.
func CanDeleteDocument ¶
CanDeleteDocument returns if the clinet has permission to change a given document.
func CanManageVersion ¶ added in v1.59.0
CanManageVersion returns if the user has permission to manage versions in space.
func CanUploadDocument ¶
CanUploadDocument returns if the client has permission to upload documents to the given space.
func CanViewDocument ¶
CanViewDocument returns if the client has permission to view a given document.
func CanViewDrafts ¶ added in v1.59.0
CanViewDrafts returns if the user has permission to view drafts in space.
func CanViewSpace ¶
CanViewSpace returns if the user has permission to view the given spaceID.
func CanViewSpaceDocument ¶
CanViewSpaceDocument returns if the user has permission to view a document within the specified folder.
func CheckPermission ¶ added in v1.66.0
func CheckPermission(ctx domain.RequestContext, s domain.Store, spaceID string, userID string, actions ...pm.Action) bool
CheckPermission returns if specified user can perform specified actions.
func GetUsersWithDocumentPermission ¶ added in v1.63.0
func GetUsersWithDocumentPermission(ctx domain.RequestContext, s domain.Store, spaceID, documentID string, permissionRequired pm.Action) (users []u.User, err error)
GetUsersWithDocumentPermission returns list of users who have specified document permission in given space
func HasPermission ¶
func HasPermission(ctx domain.RequestContext, s domain.Store, spaceID string, actions ...pm.Action) bool
HasPermission returns if current user can perform specified actions.
Types ¶
type Handler ¶
Handler contains the runtime information such as logging and database.
func (*Handler) GetCategoryPermissions ¶
func (h *Handler) GetCategoryPermissions(w http.ResponseWriter, r *http.Request)
GetCategoryPermissions returns user permissions for given category.
func (*Handler) GetCategoryViewers ¶
func (h *Handler) GetCategoryViewers(w http.ResponseWriter, r *http.Request)
GetCategoryViewers returns user permissions for given category.
func (*Handler) GetDocumentPermissions ¶ added in v1.56.0
func (h *Handler) GetDocumentPermissions(w http.ResponseWriter, r *http.Request)
GetDocumentPermissions returns permissions for all users for given document.
func (*Handler) GetSpacePermissions ¶
func (h *Handler) GetSpacePermissions(w http.ResponseWriter, r *http.Request)
GetSpacePermissions returns permissions for all users for given space.
func (*Handler) GetUserDocumentPermissions ¶ added in v1.56.0
func (h *Handler) GetUserDocumentPermissions(w http.ResponseWriter, r *http.Request)
GetUserDocumentPermissions returns permissions for the requested document, for current user.
func (*Handler) GetUserSpacePermissions ¶
func (h *Handler) GetUserSpacePermissions(w http.ResponseWriter, r *http.Request)
GetUserSpacePermissions returns permissions for the requested space, for current user.
func (*Handler) SetCategoryPermissions ¶
func (h *Handler) SetCategoryPermissions(w http.ResponseWriter, r *http.Request)
SetCategoryPermissions persists specified category permissions
func (*Handler) SetDocumentPermissions ¶ added in v1.56.0
func (h *Handler) SetDocumentPermissions(w http.ResponseWriter, r *http.Request)
SetDocumentPermissions persists specified document permissions These permissions override document permissions
func (*Handler) SetSpacePermissions ¶
func (h *Handler) SetSpacePermissions(w http.ResponseWriter, r *http.Request)
SetSpacePermissions persists specified space permissions