Class: Textus::Domain::Permission

Inherits:
Data
  • Object
show all
Defined in:
lib/textus/domain/permission.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#readable_byObject (readonly)

Returns the value of attribute readable_by

Returns:

  • (Object)

    the current value of readable_by



3
4
5
# File 'lib/textus/domain/permission.rb', line 3

def readable_by
  @readable_by
end

#writable_byObject (readonly)

Returns the value of attribute writable_by

Returns:

  • (Object)

    the current value of writable_by



3
4
5
# File 'lib/textus/domain/permission.rb', line 3

def writable_by
  @writable_by
end

#zoneObject (readonly)

Returns the value of attribute zone

Returns:

  • (Object)

    the current value of zone



3
4
5
# File 'lib/textus/domain/permission.rb', line 3

def zone
  @zone
end

Instance Method Details

#allows_read?(role) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/textus/domain/permission.rb', line 8

def allows_read?(role)
  return true if readable_by == :all

  readable_by.include?(role.to_s)
end

#allows_write?(role) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/textus/domain/permission.rb', line 4

def allows_write?(role)
  writable_by.include?(role.to_s)
end