permission

package
v1.57.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2018 License: AGPL-3.0 Imports: 16 Imported by: 36

Documentation

Overview

Package permission handles API calls and persistence for spaces. Spaces in Documize contain documents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanChangeDocument

func CanChangeDocument(ctx domain.RequestContext, s domain.Store, documentID string) bool

CanChangeDocument returns if the clinet has permission to change a given document.

func CanDeleteDocument

func CanDeleteDocument(ctx domain.RequestContext, s domain.Store, documentID string) bool

CanDeleteDocument returns if the clinet has permission to change a given document.

func CanUploadDocument

func CanUploadDocument(ctx domain.RequestContext, s domain.Store, spaceID string) bool

CanUploadDocument returns if the client has permission to upload documents to the given space.

func CanViewDocument

func CanViewDocument(ctx domain.RequestContext, s domain.Store, documentID string) bool

CanViewDocument returns if the client has permission to view a given document.

func CanViewSpace

func CanViewSpace(ctx domain.RequestContext, s domain.Store, spaceID string) bool

CanViewSpace returns if the user has permission to view the given spaceID.

func CanViewSpaceDocument

func CanViewSpaceDocument(ctx domain.RequestContext, s domain.Store, labelID string) bool

CanViewSpaceDocument returns if the user has permission to view a document within the specified folder.

func GetDocumentApprovers added in v1.56.0

func GetDocumentApprovers(ctx domain.RequestContext, s domain.Store, spaceID, documentID string) (users []u.User, err error)

GetDocumentApprovers returns list of users who can approve given document in given space

func HasPermission

func HasPermission(ctx domain.RequestContext, s domain.Store, spaceID string, actions ...pm.Action) bool

HasPermission returns if user can perform specified actions.

Types

type Handler

type Handler struct {
	Runtime *env.Runtime
	Store   *domain.Store
}

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

Directories

Path Synopsis
Package mysql handles data persistence for space and document permissions.
Package mysql handles data persistence for space and document permissions.

Jump to

Keyboard shortcuts

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