Sha256: fa6f64efc3fa7cc856136a9458bfea352eea7042aa99b85667c7129575b6b105

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

module CurationConcern
  module WithEditors
    extend ActiveSupport::Concern

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

    # @param groups [Array<String>] a list of group names to add
    def add_editor_groups(groups)
      groups.each { |g| add_editor_group(g) }
    end

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

    # @param groups [Array<String>] a list of users to remove
    def remove_editor_groups(groups)
      groups.each { |g| remove_editor_group(g) }
    end

    # @param user [String] the user account you want to grant edit access to.
    def add_editor(user)
      self.edit_users += [user]
    end

    # @param users [Array<String>] a list of users to add
    def add_editors(users)
      users.each { |u| add_editor(u) }
    end

    # @param user [String] the user account you want to revoke edit access for.
    def remove_editor(user)
      self.edit_users -= [user]
    end

    # @param users [Array<String>] a list of users to remove
    def remove_editors(users)
      users.each { |u| remove_editor(u) }
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
worthwhile-0.1.2 worthwhile-models/app/models/concerns/curation_concern/with_editors.rb
worthwhile-models-0.1.2 app/models/concerns/curation_concern/with_editors.rb
worthwhile-0.1.1 worthwhile-models/app/models/concerns/curation_concern/with_editors.rb
worthwhile-models-0.1.1 app/models/concerns/curation_concern/with_editors.rb
worthwhile-0.1.0 worthwhile-models/app/models/concerns/curation_concern/with_editors.rb
worthwhile-models-0.1.0 app/models/concerns/curation_concern/with_editors.rb
worthwhile-0.0.3 app/models/concerns/curation_concern/with_editors.rb
worthwhile-0.0.2 app/models/concerns/curation_concern/with_editors.rb
worthwhile-0.0.1 app/models/concerns/curation_concern/with_editors.rb