Class: TheCity::Permissions
Overview
The permissions associated with the current user
Instance Attribute Summary collapse
-
#admin ⇒ Boolean
readonly
The id associated with the church account.
-
#admin_privileges ⇒ Array
readonly
An array of admin privileges the user has on the current account.
-
#can_create_in_group_ids ⇒ Hash
readonly
The id associated with the church account.
-
#can_list_in_plaza ⇒ Boolean
readonly
The name of the church, ‘Grace Church’.
-
#member ⇒ Boolean
readonly
The subdomain used to access this account, subdomain.onthecity.org.
-
#staff ⇒ Boolean
readonly
The id associated with the church account.
Attributes inherited from Base
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
#admin ⇒ Boolean (readonly)
Returns 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 is_account_admin? 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_privileges ⇒ Array (readonly)
Returns 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 is_account_admin? 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_ids ⇒ Hash (readonly)
Returns 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 is_account_admin? 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_plaza ⇒ Boolean (readonly)
Returns 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 is_account_admin? 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 |
#member ⇒ Boolean (readonly)
Returns 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 is_account_admin? 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 |
#staff ⇒ Boolean (readonly)
Returns 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 is_account_admin? 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
20 21 22 |
# File 'lib/the_city/permissions.rb', line 20 def is_account_admin? admin_privileges.any? {|ap| ap[:title] == 'Account Admin'} rescue false end |
#is_user_admin? ⇒ 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 |