Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsPermission ¶
ContainsPermission checks if action matches one of the required actions?
func HasAnyPermission ¶
HasAnyPermission returns true if user has at least one permission.
Types ¶
type Action ¶
type Action string
Action details type of action
const ( // SpaceView action means you can view a space and documents therein SpaceView Action = "view" // SpaceManage action means you can add, remove users, set permissions, but not delete that space SpaceManage Action = "manage" // SpaceOwner action means you can delete a space and do all SpaceManage functions SpaceOwner Action = "own" // DocumentAdd action means you can create/upload documents to a space DocumentAdd Action = "doc-add" // DocumentEdit action means you can edit documents in a space DocumentEdit Action = "doc-edit" // DocumentDelete means you can delete documents in a space DocumentDelete Action = "doc-delete" // DocumentMove means you can move documents between spaces DocumentMove Action = "doc-move" // DocumentCopy means you can copy documents within and between spaces DocumentCopy Action = "doc-copy" // DocumentTemplate means you can create, edit and delete document templates and content blocks DocumentTemplate Action = "doc-template" // CategoryView action means you can view a category and documents therein CategoryView Action = "view" )
type CategoryViewRequestModel ¶
type CategoryViewRequestModel struct { OrgID string `json:"orgId"` SpaceID string `json:"folderId"` CategoryID string `json:"categoryID"` UserID string `json:"userId"` }
CategoryViewRequestModel represents who should be allowed to see a category.
type Permission ¶
type Permission struct { ID uint64 `json:"id"` OrgID string `json:"orgId"` Who string `json:"who"` // user, role WhoID string `json:"whoId"` // either a user or role ID Action Action `json:"action"` // view, edit, delete Scope string `json:"scope"` // object, table Location string `json:"location"` // table name RefID string `json:"refId"` // id of row in table / blank when scope=table Created time.Time `json:"created"` }
Permission represents a permission for a space and is persisted to the database.
func EncodeRecord ¶
func EncodeRecord(r Record, a Action) (p Permission)
EncodeRecord creates standard permission record representing user permissions for a space.
func EncodeUserPermissions ¶
func EncodeUserPermissions(r Record) (perm []Permission)
EncodeUserPermissions returns multiple user permission records for a given space, using flat permission summary record.
type PermissionsModel ¶
PermissionsModel details which users have what permissions on a given space.
type Record ¶
type Record struct { OrgID string `json:"orgId"` SpaceID string `json:"folderId"` UserID string `json:"userId"` SpaceView bool `json:"spaceView"` SpaceManage bool `json:"spaceManage"` SpaceOwner bool `json:"spaceOwner"` DocumentAdd bool `json:"documentAdd"` DocumentEdit bool `json:"documentEdit"` DocumentDelete bool `json:"documentDelete"` DocumentMove bool `json:"documentMove"` DocumentCopy bool `json:"documentCopy"` DocumentTemplate bool `json:"documentTemplate"` }
Record represents space permissions for a user on a space. This data structure is made from database permission records for the space, and it is designed to be sent to HTTP clients (web, mobile).
func DecodeUserPermissions ¶
func DecodeUserPermissions(perm []Permission) (r Record)
DecodeUserPermissions returns a flat, usable permission summary record from multiple user permission records for a given space.