First version for App and Object auth.Taking Announcement as experiment

This commit is contained in:
Matthew Kaito Juyuan Fu authored and Christophe Vilayphiou committed 2012-02-29 18:55:55 +08:00
1 parent 3bcd7ea349
commit cc550c5745
28 files changed
+146 -34

No files matched your search

@@ -1,8 +1,12 @@
class Admin::ObjectAuthsController < ApplicationController
include OrbitCoreLib::PermissionUnility
layout "admin"
before_filter :authenticate_user!
before_filter :check_if_user_can_do_object_auth
# before_filter :is_admin? ,:only => :index
def index
# if current_user.admin?
@object_auths = ObjectAuth.all
@@ -70,7 +74,11 @@ class Admin::ObjectAuthsController < ApplicationController
def edit
@object_auth = ObjectAuth.find(params[:id])
end
private
def check_if_user_can_do_object_auth
unless check_permission(:manager)
render :nothing => true, :status => 403
end
end
end
@@ -1,3 +0,0 @@
class ObitFrontendController< ObitFrontendComponentController
end
@@ -1,3 +0,0 @@
class ObitWidgetController< ObitFrontendComponentController
end
@@ -0,0 +1,24 @@
class OrbitBackendController< ApplicationController
before_filter :authenticate_user!
before_filter :setup_vars
# before_filter {|c| c.front_end_available(@app_title)}
before_filter :check_user_can_use,:except => [:public]
include OrbitCoreLib::PermissionUnility
layout 'admin'
def setup_vars
@app_title = request.fullpath.split('/')[2]
@module_app = ModuleApp.first(conditions: {:key => @app_title} )
end
private
def check_user_can_use
unless check_permission
redirect_to polymorphic_path(['panel',@app_title,'back_end','public'])
end
end
end
@@ -1,4 +1,4 @@
class ObitFrontendComponentController< ApplicationController
class OrbitFrontendComponentController< ApplicationController
before_filter :setup_vars
before_filter {|c| c.front_end_available(@app_title)}
layout 'module_widget'
@@ -0,0 +1,3 @@
class OrbitFrontendController< OrbitFrontendComponentController
end
@@ -0,0 +1,3 @@
class ObitWidgetController< OrbitFrontendComponentController
end