Documentation ¶
Index ¶
- Constants
- func Delete(ptr Permitter) error
- func Move(from, to Permitter) error
- func Set(ptr Permitter, permissions *Permission) error
- func Valid(permission string) bool
- type Permission
- func AppAvailable() *Permission
- func AppNewDefault(owner string) *Permission
- func Application() *Permission
- func Backup() *Permission
- func DatastoreDir() *Permission
- func DatastoreDownload(base *Permission) *Permission
- func DatastoreDrop(base *Permission) *Permission
- func DatastoreNew() *Permission
- func DatastoreNewDefault(owner string) *Permission
- func Doc() *Permission
- func FileNewDefault(owner string) *Permission
- func FileRoot() *Permission
- func Get(ptr Permitter) (*Permission, error)
- func Log() *Permission
- func Properties(base *Permission) *Permission
- func Session() *Permission
- func Settings() *Permission
- func Token(owner string) *Permission
- func User(owner string) *Permission
- func UserMakeAdmin() *Permission
- func UserRemoveAdmin(owner string) *Permission
- type Permitter
Constants ¶
const ( // DS is the location of the permissions datastore DS = "core" + string(os.PathSeparator) + "permission.ds" // Read permission constant Read = "r" // Write permission constant Write = "w" // InvalidID consant for an invalid permission id InvalidID = "" )
Variables ¶
This section is empty.
Functions ¶
func Set ¶
func Set(ptr Permitter, permissions *Permission) error
Set sets the passed in permissions for the passed in permitter
Types ¶
type Permission ¶
type Permission struct { Owner string `json:"owner,omitempty"` Public string `json:"public,omitempty"` Friend string `json:"friend,omitempty"` Private string `json:"private,omitempty"` // contains filtered or unexported fields }
Permission controls access to a resource in freehold
func AppNewDefault ¶
func AppNewDefault(owner string) *Permission
Default permissions for new application files
func Application ¶
func Application() *Permission
admins can install / write authenticated users can view installed apps
func Backup ¶
func Backup() *Permission
func DatastoreDir ¶
func DatastoreDir() *Permission
func DatastoreDownload ¶
func DatastoreDownload(base *Permission) *Permission
func DatastoreDrop ¶
func DatastoreDrop(base *Permission) *Permission
func DatastoreNew ¶
func DatastoreNew() *Permission
func DatastoreNewDefault ¶
func DatastoreNewDefault(owner string) *Permission
func FileNewDefault ¶
func FileNewDefault(owner string) *Permission
Default file permissions for new files
func FileRoot ¶
func FileRoot() *Permission
FileRoot returns the permissions for the root file directory. Only admins can create / delete folders at the root
func Get ¶
func Get(ptr Permitter) (*Permission, error)
Get the permissions by ID what the ID is will depend on the resource
func Log ¶
func Log() *Permission
func Properties ¶
func Properties(base *Permission) *Permission
Only owners can update properties. Public can't view any properties authenticated users who have read rights can read properties
func Session ¶
func Session() *Permission
Only authenticated users (and not partially authenticated tokens) can write a new sesion or view an existing one
func Settings ¶
func Settings() *Permission
func Token ¶
func Token(owner string) *Permission
func User ¶
func User(owner string) *Permission
func UserMakeAdmin ¶
func UserMakeAdmin() *Permission
func UserRemoveAdmin ¶
func UserRemoveAdmin(owner string) *Permission
type Permitter ¶
type Permitter interface { ID() string Permission() (*Permission, error) }
Permitter is the interface of methods requried to assign permissions