Class: TheCity::Permissions

Inherits:
Base
  • Object
show all
Defined in:
lib/the_city/permissions.rb

Overview

The permissions associated with the current user

Instance Attribute Summary collapse

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

#[], attr_reader, define_attribute_method, define_predicate_method, define_uri_method, from_response, #initialize, #memoize, object_attr_reader, uri_attr_reader

Constructor Details

This class inherits a constructor from TheCity::Base

Instance Attribute Details

#adminBoolean (readonly)

Returns The id associated with the church account.

Returns:

  • (Boolean)

    The id associated with the church account



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/the_city/permissions.rb', line 17

class Permissions < TheCity::Base
  attr_reader :can_list_in_plaza, :member, :staff, :admin, :can_create_in_group_ids, :admin_privileges

  def 
    admin_privileges.any? {|ap| ap[:title] == 'Account Admin'} rescue false
  end

  def is_user_admin?
    admin_privileges.any? {|ap| ap[:title] == 'User Admin'} rescue false
  end

end

#admin_privilegesArray (readonly)

Returns An array of admin privileges the user has on the current account.

Returns:

  • (Array)

    An array of admin privileges the user has on the current account



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/the_city/permissions.rb', line 17

class Permissions < TheCity::Base
  attr_reader :can_list_in_plaza, :member, :staff, :admin, :can_create_in_group_ids, :admin_privileges

  def 
    admin_privileges.any? {|ap| ap[:title] == 'Account Admin'} rescue false
  end

  def is_user_admin?
    admin_privileges.any? {|ap| ap[:title] == 'User Admin'} rescue false
  end

end

#can_create_in_group_idsHash (readonly)

Returns The id associated with the church account.

Returns:

  • (Hash)

    The id associated with the church account



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/the_city/permissions.rb', line 17

class Permissions < TheCity::Base
  attr_reader :can_list_in_plaza, :member, :staff, :admin, :can_create_in_group_ids, :admin_privileges

  def 
    admin_privileges.any? {|ap| ap[:title] == 'Account Admin'} rescue false
  end

  def is_user_admin?
    admin_privileges.any? {|ap| ap[:title] == 'User Admin'} rescue false
  end

end

#can_list_in_plazaBoolean (readonly)

Returns The name of the church, ‘Grace Church’.

Returns:

  • (Boolean)

    The name of the church, ‘Grace Church’.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/the_city/permissions.rb', line 17

class Permissions < TheCity::Base
  attr_reader :can_list_in_plaza, :member, :staff, :admin, :can_create_in_group_ids, :admin_privileges

  def 
    admin_privileges.any? {|ap| ap[:title] == 'Account Admin'} rescue false
  end

  def is_user_admin?
    admin_privileges.any? {|ap| ap[:title] == 'User Admin'} rescue false
  end

end

#memberBoolean (readonly)

Returns The subdomain used to access this account, subdomain.onthecity.org.

Returns:

  • (Boolean)

    The subdomain used to access this account, subdomain.onthecity.org



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/the_city/permissions.rb', line 17

class Permissions < TheCity::Base
  attr_reader :can_list_in_plaza, :member, :staff, :admin, :can_create_in_group_ids, :admin_privileges

  def 
    admin_privileges.any? {|ap| ap[:title] == 'Account Admin'} rescue false
  end

  def is_user_admin?
    admin_privileges.any? {|ap| ap[:title] == 'User Admin'} rescue false
  end

end

#staffBoolean (readonly)

Returns The id associated with the church account.

Returns:

  • (Boolean)

    The id associated with the church account



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/the_city/permissions.rb', line 17

class Permissions < TheCity::Base
  attr_reader :can_list_in_plaza, :member, :staff, :admin, :can_create_in_group_ids, :admin_privileges

  def 
    admin_privileges.any? {|ap| ap[:title] == 'Account Admin'} rescue false
  end

  def is_user_admin?
    admin_privileges.any? {|ap| ap[:title] == 'User Admin'} rescue false
  end

end

Instance Method Details

#is_account_admin?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/the_city/permissions.rb', line 20

def 
  admin_privileges.any? {|ap| ap[:title] == 'Account Admin'} rescue false
end

#is_user_admin?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/the_city/permissions.rb', line 24

def is_user_admin?
  admin_privileges.any? {|ap| ap[:title] == 'User Admin'} rescue false
end