Class: Relation::Public

Inherits:
Relation
  • Object
show all
Defined in:
app/models/relation/public.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Relation

allow, allow?, #mode, normalize, normalize_id

Class Method Details

.default_for(actor) ⇒ Object



9
10
11
# File 'app/models/relation/public.rb', line 9

def default_for(actor)
  create! :actor => actor
end

.of(actor) ⇒ Object

The Relation::Public belonging to actor



14
15
16
# File 'app/models/relation/public.rb', line 14

def of(actor)
  actor(actor).first
end

Instance Method Details

#<=>(relation) ⇒ Object

A public relation is always the weakest



20
21
22
# File 'app/models/relation/public.rb', line 20

def <=>(relation)
  1
end

#allow?(user, action, object) ⇒ Boolean

Are we supporting custom permissions for Relation::Public? Not by the moment.

Returns:

  • (Boolean)


30
31
32
# File 'app/models/relation/public.rb', line 30

def allow?(user, action, object)
  action == 'read' && object == 'activity'
end

#nameObject

The name of public relation



25
26
27
# File 'app/models/relation/public.rb', line 25

def name
  I18n.t('relation_public.name')
end