Class: Permission

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/permission.rb

Overview

SocialStream provides a system of permissions based on the relations of the social network as roles.

Permissions and Relations

Permissions are assigned to Relations, and through relations, to Ties. When a sender establishes a Tie with a receiver, she is granting to the receiver the permissions assigned to Relation of the Tie she has just established.

For example, when Alice establishes a friend tie to Bob, she is granting him the permissions associated with her friend relation. Alice’s friend relation may have different permissions from Bob’s friend relation.

Permissions description

Permissions are composed by action and object. Action and object are typical in content management systems, e.g. create activity, update tie, read post.

Actions

Current available actions are:

create

add a new instance of something (activity, tie, post, etc)

read

view something

update

modify something

destroy

delete something

follow

subscribe to activity updates from the receiver of the tie

represent

give the receiver rights to act as if he were me.

Objectives

activity

all the objects in a wall: posts, comments

Other objects currently not implemented could be tie, post, comment or message

Instance Method Summary collapse

Instance Method Details

#description(type, options = {}) ⇒ Object

An explanation of the permissions. Type can be brief or detailed. If detailed, description includes more information about the relation



48
49
50
51
# File 'app/models/permission.rb', line 48

def description(type, options = {})
  I18n.t "permission.description.#{ type }.#{ action }.#{ object || "nil" }",
         options
end