object

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2015 License: AGPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Objects is the bucket that contains all Objects.
	Objects db.Bucket = "object-objects"
)

Variables

This section is empty.

Functions

func Buckets

func Buckets() []db.Bucket

Buckets returns the Buckets for the object database.

func Delete

func Delete(d db.DB, email string, id util.Key) error

Delete deletes an object given a user and an Object id.

func DeleteAll

func DeleteAll(d db.DB, email string) error

DeleteAll deletes all Objects owned by the given user.

func Put

func Put(d db.DB, email string, id util.Key, obj *Object) error

Put stores an object by id for the given user, if the user is authorized.

Types

type Object

type Object struct {
	// Json contains arbitrary text.
	JSON string `json:"json,omitempty"`

	// Perms defines the permissions for the object.
	Perms util.Permissions `json:"perms,omitempty"`
}

Object is an object containing its own permissions.

func Get

func Get(d db.DB, email string, id util.Key) (*Object, error)

Get fetches an object by ID, if the user has permission to view it.

func New

func New(json, user string) *Object

New makes an object with the given json and default (owner only) permissions.

func (*Object) ReadAuthorized

func (o *Object) ReadAuthorized(email string) error

ReadAuthorized determines if a user is authorized to use an object.

func (*Object) WriteAuthorized

func (o *Object) WriteAuthorized(email string) error

WriteAuthorized determines if a user is authorized to write an object.

Jump to

Keyboard shortcuts

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