diff options
author | hellekin <hellekin@cepheide.org> | 2020-10-06 04:26:25 +0200 |
---|---|---|
committer | hellekin <hellekin@cepheide.org> | 2020-10-06 04:26:25 +0200 |
commit | 56a16be5fb51d8f6a8b04e9e7094aa7c57fb8547 (patch) | |
tree | 83280700beda03eaa0786cdd8c94c93a1533f18b /app/controllers/users_controller.rb | |
parent | 09ac92747bfbda80a54e44b22576d29d9dfc63c3 (diff) | |
download | incommon-map-56a16be5fb51d8f6a8b04e9e7094aa7c57fb8547.tar.gz |
First pass at something visible
This is a first version of the application, to go beyond simple authentication.
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r-- | app/controllers/users_controller.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb new file mode 100644 index 0000000..2cfa2ab --- /dev/null +++ b/app/controllers/users_controller.rb @@ -0,0 +1,20 @@ +class UsersController < ApplicationController + # GET /my/users + # If you're a leader, you will see a list of Agent members + def index + begin + return 403 unless current_user.agencies.find_by(name: current_agent).leader? + rescue Exception => e + Rails.logger.info("Exception %s: %s" % [e.class, e.message]) + flash[:notice] = "Talk to your leader!" + redirect_to root_url and return + end + + @users = Agent.where(name: current_agent).members + end + + # GET /my/account + def show + @user = current_user + end +end |