Module: CurationConcern::WithEditors

Extended by:
ActiveSupport::Concern
Included in:
Work
Defined in:
app/models/concerns/curation_concern/with_editors.rb

Instance Method Summary collapse

Instance Method Details

#add_editor(user) ⇒ Object

Parameters:

  • user (String)

    the user account you want to grant edit access to.



24
25
26
# File 'app/models/concerns/curation_concern/with_editors.rb', line 24

def add_editor(user)
  self.edit_users += [user]
end

#add_editor_group(group_name) ⇒ Object



5
6
7
# File 'app/models/concerns/curation_concern/with_editors.rb', line 5

def add_editor_group(group_name)
  self.edit_groups += [group]
end

#add_editor_groups(groups) ⇒ Object

Parameters:

  • groups (Array<String>)

    a list of group names to add



10
11
12
# File 'app/models/concerns/curation_concern/with_editors.rb', line 10

def add_editor_groups(groups)
  groups.each { |g| add_editor_group(g) }
end

#add_editors(users) ⇒ Object

Parameters:

  • users (Array<String>)

    a list of users to add



29
30
31
# File 'app/models/concerns/curation_concern/with_editors.rb', line 29

def add_editors(users)
  users.each { |u| add_editor(u) }
end

#remove_editor(user) ⇒ Object

Parameters:

  • user (String)

    the user account you want to revoke edit access for.



34
35
36
# File 'app/models/concerns/curation_concern/with_editors.rb', line 34

def remove_editor(user)
  self.edit_users -= [user]
end

#remove_editor_group(group) ⇒ Object



14
15
16
# File 'app/models/concerns/curation_concern/with_editors.rb', line 14

def remove_editor_group(group)
  self.edit_groups -= [group]
end

#remove_editor_groups(groups) ⇒ Object

Parameters:

  • groups (Array<String>)

    a list of users to remove



19
20
21
# File 'app/models/concerns/curation_concern/with_editors.rb', line 19

def remove_editor_groups(groups)
  groups.each { |g| remove_editor_group(g) }
end

#remove_editors(users) ⇒ Object

Parameters:

  • users (Array<String>)

    a list of users to remove



39
40
41
# File 'app/models/concerns/curation_concern/with_editors.rb', line 39

def remove_editors(users)
  users.each { |u| remove_editor(u) }
end