Class: Hyrax::PermissionManager
- Inherits:
-
Object
- Object
- Hyrax::PermissionManager
- Defined in:
- app/services/hyrax/permission_manager.rb
Overview
Provides setters and getters for the three most common permission modes:
- :discover
- :edit
- :read
Constant Summary collapse
- DISCOVER =
:discover
- EDIT =
:edit
- READ =
:read
Instance Attribute Summary collapse
Instance Method Summary collapse
- #discover_groups ⇒ Enumerable<String>
- #discover_groups=(groups) ⇒ Enumerable<String>
- #discover_users ⇒ Enumerable<String>
- #discover_users=(users) ⇒ Enumerable<String>
- #edit_groups ⇒ Enumerable<String>
- #edit_groups=(groups) ⇒ Enumerable<String>
- #edit_users ⇒ Enumerable<String>
- #edit_users=(users) ⇒ Enumerable<String>
-
#initialize(resource:, acl_class: Hyrax::AccessControlList) ⇒ PermissionManager
constructor
A new instance of PermissionManager.
- #read_groups ⇒ Enumerable<String>
- #read_groups=(groups) ⇒ Enumerable<String>
- #read_users ⇒ Enumerable<String>
- #read_users=(users) ⇒ Enumerable<String>
Constructor Details
#initialize(resource:, acl_class: Hyrax::AccessControlList) ⇒ PermissionManager
Returns a new instance of PermissionManager.
47 48 49 |
# File 'app/services/hyrax/permission_manager.rb', line 47 def initialize(resource:, acl_class: Hyrax::AccessControlList) self.acl = acl_class.new(resource: resource) end |
Instance Attribute Details
#acl ⇒ Hyrax::AccessControlList
43 44 45 |
# File 'app/services/hyrax/permission_manager.rb', line 43 def acl @acl end |
Instance Method Details
#discover_groups ⇒ Enumerable<String>
53 54 55 |
# File 'app/services/hyrax/permission_manager.rb', line 53 def discover_groups groups_for(mode: DISCOVER) end |
#discover_groups=(groups) ⇒ Enumerable<String>
61 62 63 64 |
# File 'app/services/hyrax/permission_manager.rb', line 61 def discover_groups=(groups) update_groups_for(mode: DISCOVER, groups: groups) discover_groups end |
#discover_users ⇒ Enumerable<String>
68 69 70 |
# File 'app/services/hyrax/permission_manager.rb', line 68 def discover_users users_for(mode: DISCOVER) end |
#discover_users=(users) ⇒ Enumerable<String>
76 77 78 79 |
# File 'app/services/hyrax/permission_manager.rb', line 76 def discover_users=(users) update_users_for(mode: DISCOVER, users: users) discover_users end |
#edit_groups ⇒ Enumerable<String>
83 84 85 |
# File 'app/services/hyrax/permission_manager.rb', line 83 def edit_groups groups_for(mode: EDIT) end |
#edit_groups=(groups) ⇒ Enumerable<String>
91 92 93 94 |
# File 'app/services/hyrax/permission_manager.rb', line 91 def edit_groups=(groups) update_groups_for(mode: EDIT, groups: groups) edit_groups end |
#edit_users ⇒ Enumerable<String>
98 99 100 |
# File 'app/services/hyrax/permission_manager.rb', line 98 def edit_users users_for(mode: EDIT) end |
#edit_users=(users) ⇒ Enumerable<String>
106 107 108 109 |
# File 'app/services/hyrax/permission_manager.rb', line 106 def edit_users=(users) update_users_for(mode: EDIT, users: users) edit_users end |
#read_groups ⇒ Enumerable<String>
113 114 115 |
# File 'app/services/hyrax/permission_manager.rb', line 113 def read_groups groups_for(mode: READ) end |
#read_groups=(groups) ⇒ Enumerable<String>
121 122 123 124 |
# File 'app/services/hyrax/permission_manager.rb', line 121 def read_groups=(groups) update_groups_for(mode: READ, groups: groups) read_groups end |
#read_users ⇒ Enumerable<String>
128 129 130 |
# File 'app/services/hyrax/permission_manager.rb', line 128 def read_users users_for(mode: READ) end |
#read_users=(users) ⇒ Enumerable<String>
136 137 138 139 |
# File 'app/services/hyrax/permission_manager.rb', line 136 def read_users=(users) update_users_for(mode: READ, users: users) read_users end |