summaryrefslogtreecommitdiff
path: root/users/app/controllers/users_base_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'users/app/controllers/users_base_controller.rb')
-rw-r--r--users/app/controllers/users_base_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/users/app/controllers/users_base_controller.rb b/users/app/controllers/users_base_controller.rb
new file mode 100644
index 0000000..dc2fa16
--- /dev/null
+++ b/users/app/controllers/users_base_controller.rb
@@ -0,0 +1,18 @@
+#
+# common base class for all user related controllers
+#
+
+class UsersBaseController < ApplicationController
+
+ protected
+
+ def fetch_user
+ @user = User.find_by_param(params[:user_id] || params[:id])
+ if !@user && admin?
+ redirect_to users_url, :alert => t(:no_such_thing, :thing => 'user')
+ elsif !admin? && @user != current_user
+ access_denied
+ end
+ end
+
+end