Method: Anoubis::Sso::Client::ApplicationController#menu_access

Defined in:
app/controllers/anoubis/sso/client/application_controller.rb

Return access status for current user



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'app/controllers/anoubis/sso/client/application_controller.rb', line 120

def menu_access(controller, exit = true)
  menu_access_status = 'not'

  if self.current_user
    if self.current_user.menus
      if self.current_user.menus.key? controller.to_s.to_sym
        menu_access_status = self.current_user.menus[controller.to_s.to_sym]
      end
    end
  end

  if menu_access_status == 'not'
    self.error_exit({ error: I18n.t('errors.access_not_allowed') }) if exit
    return false
  end

  self.writer = true if menu_access_status == 'write'
  true
end