Class: PuavoRest::Organisations

Inherits:
PuavoSinatra
  • Object
show all
Defined in:
resources/organisations.rb

Constant Summary

Constant Summary

Constants inherited from PuavoSinatra

PuavoSinatra::ROOT

Instance Method Summary (collapse)

Methods inherited from PuavoSinatra

#auth, #basic_auth, #flog, #flog=, #from_post, #json_params, #kerberos, #legacy_server_auth, #limit, #pw_mgmt_server_auth, #server_auth, #txt

Instance Method Details

- (Object) require_admin!



125
126
127
128
129
# File 'resources/organisations.rb', line 125

def require_admin!
  if not User.current.admin?
    raise Unauthorized, :user => "Sorry, only administrators can access this resource."
  end
end

- (Object) require_admin_or_not_people!



131
132
133
134
135
# File 'resources/organisations.rb', line 131

def require_admin_or_not_people!
  return if not LdapModel.settings[:credentials][:dn].to_s.downcase.match(/people/)

  require_admin!
end