Class: Hyrax::AccessControlList::ModeRevoke Private

Inherits:
ModeEditor
  • Object
show all
Defined in:
app/services/hyrax/access_control_list.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A short-term memory object for the permission revoking DSL. Use with method chaining, as in: `acl.revoke(:edit).from(user)`.

Instance Method Summary collapse

Methods inherited from ModeEditor

#initialize

Constructor Details

This class inherits a constructor from Hyrax::AccessControlList::ModeEditor

Instance Method Details

#from(user_or_group) ⇒ Hyrax::AccessControlList


226
227
228
229
230
231
232
233
234
# File 'app/services/hyrax/access_control_list.rb', line 226

def from(user_or_group)
  permission_for_deletion = @acl.permissions.find do |p|
    p.mode == @mode &&
      p.agent.to_s == id_for(agent: user_or_group)
  end

  @acl.delete(permission_for_deletion) if permission_for_deletion
  @acl
end