Module: Sufia::GenericFile::Permissions
- Extended by:
- ActiveSupport::Concern
- Includes:
- Hydra::AccessControls::Permissions, Hydra::AccessControls::Visibility
- Included in:
- Sufia::GenericFile
- Defined in:
- lib/sufia/models/generic_file/permissions.rb
Instance Method Summary collapse
- #paranoid_permissions ⇒ Object
- #permissions ⇒ Object
-
#permissions=(params) ⇒ Object
Updates those permissions that are provided to it.
Instance Method Details
#paranoid_permissions ⇒ Object
14 15 16 17 18 |
# File 'lib/sufia/models/generic_file/permissions.rb', line 14 def # let the rightsMetadata ds make this determination # - the object instance is passed in for easier access to the props ds rightsMetadata.validate(self) end |
#permissions ⇒ Object
32 33 34 35 |
# File 'lib/sufia/models/generic_file/permissions.rb', line 32 def perms = super perms.map {|p| { name: p.name, access: p.access, type:p.type } } end |
#permissions=(params) ⇒ Object
Updates those permissions that are provided to it. Does not replace any permissions unless they are provided
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sufia/models/generic_file/permissions.rb', line 21 def (params) perm_hash = params[:new_user_name].each { |name, access| perm_hash['person'][name] = access } if params[:new_user_name].present? params[:new_group_name].each { |name, access| perm_hash['group'][name] = access } if params[:new_group_name].present? params[:user].each { |name, access| perm_hash['person'][name] = access} if params[:user] params[:group].each { |name, access| perm_hash['group'][name] = access if ['read', 'edit'].include?(access)} if params[:group] rightsMetadata.(perm_hash) end |