Module: RightsService

Defined in:
app/services/rights_service.rb

Class Method Summary collapse

Class Method Details

.active?(id) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/services/rights_service.rb', line 15

def self.active?(id)
  authority.find(id).fetch('active')
end

.active_elementsObject



23
24
25
# File 'app/services/rights_service.rb', line 23

def self.active_elements
  authority.all.select { |e| authority.find(e[:id])[:active] }
end

.label(id) ⇒ Object



19
20
21
# File 'app/services/rights_service.rb', line 19

def self.label(id)
  authority.find(id).fetch('term')
end

.select_active_optionsObject



11
12
13
# File 'app/services/rights_service.rb', line 11

def self.select_active_options
  active_elements.map { |e| [e[:label], e[:id]] }
end

.select_all_optionsObject



5
6
7
8
9
# File 'app/services/rights_service.rb', line 5

def self.select_all_options
  authority.all.map do |element|
    [element[:label], element[:id]]
  end
end