permission

package
v0.0.0-...-d8e89f0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
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 Delete

func Delete(ptr Permitter) error

Delete removes the permissions

func Move

func Move(from, to Permitter) error

Move moves the permissions from one resource to another

func Set

func Set(ptr Permitter, permissions *Permission) error

Set sets the passed in permissions for the passed in permitter

func Valid

func Valid(permission string) bool

Valid is tests if the permissions string contains valid permissions

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 AppAvailable

func AppAvailable() *Permission

admin only

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 Doc

func Doc() *Permission

Doc is open to public

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

func (*Permission) CanRead

func (p *Permission) CanRead(u *user.User) bool

CanRead tests if the passed in user can read based on the current permissions

func (*Permission) CanWrite

func (p *Permission) CanWrite(u *user.User) bool

CanWrite tests if the passed in user can write based on the current permissions

type Permitter

type Permitter interface {
	ID() string
	Permission() (*Permission, error)
}

Permitter is the interface of methods requried to assign permissions

Jump to

Keyboard shortcuts

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