Merge with sub_roles
This commit is contained in:
1 parent
fc591ee308
commit
62aaf79491
308 files changed
+2844
-17841
No files matched your search
@@ -0,0 +1,17 @@
|
||||
class Admin::AppAuthsController < ApplicationController
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
|
||||
def index
|
||||
@user_roles = UserRole.all.entries
|
||||
apps = Purchase.where(:type =>"App")
|
||||
@app_auth_data = apps.entries.map do |app|
|
||||
app_c = eval(app.app_controller)
|
||||
obj = app_c.new
|
||||
obj_auth = obj.send "auth"
|
||||
[:app_obj => app,:auth_field => obj_auth]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,63 @@
|
||||
class Admin::InfosController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||
|
||||
def index
|
||||
@attributes = Info.all.entries
|
||||
render :template => 'admin/attributes/index'
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@attribute = Info.new
|
||||
render :template => 'admin/attributes/new'
|
||||
end
|
||||
|
||||
def edit
|
||||
@attribute = Info.find(params[:id])
|
||||
@i18n_variable = @attribute.i18n_variable
|
||||
render :template => 'admin/attributes/edit'
|
||||
end
|
||||
|
||||
def create
|
||||
@attribute = Info.new(params[:info])
|
||||
@attribute.save
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def update
|
||||
@attribute = Info.find(params[:id])
|
||||
@attribute.update_attributes(params[:info])
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :action => :index }
|
||||
format.js { render 'admin/attributes/toggle_enable' }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@attribute = Info.find(params[:id])
|
||||
@attribute.destroy
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def add_attribute_field
|
||||
@attribute = Info.find(params[:id]) rescue nil
|
||||
if !@attribute
|
||||
@attribute = Info.new
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_attribute
|
||||
@attribute_type = 'info'
|
||||
@class = 'infos'
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class Admin::ModuleAppsController < ApplicationController
|
||||
|
||||
def reload_frontend_pages
|
||||
@module_app = ModuleApp.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js {}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -19,6 +19,7 @@ class Admin::PagesController < ApplicationController
|
||||
|
||||
def new
|
||||
@item = Page.new
|
||||
@apps = ModuleApp.all
|
||||
@item.is_published = true
|
||||
@item.parent_id = @parent_item.id rescue nil
|
||||
@designs = Design.all.entries
|
||||
@@ -27,6 +28,7 @@ class Admin::PagesController < ApplicationController
|
||||
|
||||
def edit
|
||||
@item = Page.find(params[:id])
|
||||
@apps = ModuleApp.all
|
||||
@i18n_variable = @item.i18n_variable
|
||||
@designs = Design.all.entries
|
||||
@design = @item.design
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
class Admin::RolesController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||
|
||||
def index
|
||||
@attributes = Role.all.entries
|
||||
render :template => 'admin/attributes/index'
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@attribute = Role.new
|
||||
render :template => 'admin/attributes/new'
|
||||
end
|
||||
|
||||
def edit
|
||||
@attribute = Role.find(params[:id])
|
||||
@i18n_variable = @attribute.i18n_variable
|
||||
render :template => 'admin/attributes/edit'
|
||||
end
|
||||
|
||||
def create
|
||||
@attribute = Role.new(params[:role])
|
||||
@attribute.save
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def update
|
||||
@attribute = Role.find(params[:id])
|
||||
@attribute.update_attributes(params[:role])
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :action => :index }
|
||||
format.js { render 'admin/attributes/toggle_enable' }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@attribute = Role.find(params[:id])
|
||||
@attribute.destroy
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_attribute
|
||||
@attribute_type = 'role'
|
||||
@class = 'roles'
|
||||
end
|
||||
|
||||
end
|
||||
@@ -68,11 +68,11 @@ class Admin::TranslationsController < ApplicationController
|
||||
result << var if var.document_class.eql?('language')
|
||||
result
|
||||
end
|
||||
@user_role_model_i18n_variables = @i18n_variables.inject([]) do |result, var|
|
||||
result << var if var.document_class.eql?('UserRoleModel')
|
||||
@role_i18n_variables = @i18n_variables.inject([]) do |result, var|
|
||||
result << var if var.document_class.eql?('Role')
|
||||
result
|
||||
end
|
||||
@user_info_model_i18n_variables = @i18n_variables.inject([]) do |result, var|
|
||||
@info_i18n_variables = @i18n_variables.inject([]) do |result, var|
|
||||
result << var if var.document_class.eql?('UserInfoModel')
|
||||
result
|
||||
end
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
class Admin::UserAttributesController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
|
||||
def index
|
||||
@user_attributes = UserAttribute.all
|
||||
end
|
||||
|
||||
def show
|
||||
@user_attribute = UserAttribute.find(params[:id])
|
||||
end
|
||||
|
||||
def new
|
||||
@user_attribute = UserAttribute.new
|
||||
end
|
||||
|
||||
def edit
|
||||
@user_attribute = UserAttribute.find(params[:id])
|
||||
end
|
||||
|
||||
def create
|
||||
@user_attribute = UserAttribute.new(params[:user_attribute])
|
||||
@user_attribute.save
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def update
|
||||
@user_attribute = UserAttribute.find(params[:id])
|
||||
@user_attribute.update_attributes(params[:user_attribute])
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user_attribute = UserAttribute.find(params[:id])
|
||||
@user_attribute.destroy
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,59 +0,0 @@
|
||||
class Admin::UserInfoModelsController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||
|
||||
def index
|
||||
@user_attribute_models = UserInfoModel.all.entries
|
||||
render :template => 'admin/user_attribute_models/index'
|
||||
end
|
||||
|
||||
def show
|
||||
#@user_attribute_model = UserInfoModel.find(params[:id])
|
||||
end
|
||||
|
||||
def new
|
||||
@user_attribute_model = UserInfoModel.new
|
||||
render :template => 'admin/user_attribute_models/new'
|
||||
end
|
||||
|
||||
def edit
|
||||
@user_attribute_model = UserInfoModel.find(params[:id])
|
||||
@i18n_variable = @user_attribute_model.i18n_variable
|
||||
render :template => 'admin/user_attribute_models/edit'
|
||||
end
|
||||
|
||||
def create
|
||||
@user_attribute_model = UserInfoModel.new(params[:user_info_model])
|
||||
@user_attribute_model.save
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def update
|
||||
@user_attribute_model = UserInfoModel.find(params[:id])
|
||||
@user_attribute_model.update_attributes(params[:user_info_model])
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :action => :index }
|
||||
format.js { render 'admin/user_attribute_models/toggle_enable' }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user_attribute_model = UserInfoModel.find(params[:id])
|
||||
@user_attribute_model.destroy
|
||||
|
||||
@user_attribute_model.destroy_i18n_variables
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_attribute
|
||||
@attribute = 'info'
|
||||
@class = 'infos'
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,60 +0,0 @@
|
||||
class Admin::UserRoleModelsController < ApplicationController
|
||||
|
||||
layout "admin"
|
||||
before_filter :authenticate_user!
|
||||
before_filter :is_admin?
|
||||
before_filter :set_attribute, :only => [:index, :show, :new, :edit]
|
||||
|
||||
def index
|
||||
@user_attribute_models = UserRoleModel.all.entries
|
||||
render :template => 'admin/user_attribute_models/index'
|
||||
end
|
||||
|
||||
def show
|
||||
#@user_attribute_model = UserRoleModel.find(params[:id])
|
||||
end
|
||||
|
||||
def new
|
||||
@user_attribute_model = UserRoleModel.new
|
||||
render :template => 'admin/user_attribute_models/new'
|
||||
end
|
||||
|
||||
def edit
|
||||
@user_attribute_model = UserRoleModel.find(params[:id])
|
||||
@i18n_variable = @user_attribute_model.i18n_variable
|
||||
render :template => 'admin/user_attribute_models/edit'
|
||||
end
|
||||
|
||||
def create
|
||||
@user_attribute_model = UserRoleModel.new(params[:user_role_model])
|
||||
@user_attribute_model.save
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
def update
|
||||
@user_attribute_model = UserRoleModel.find(params[:id])
|
||||
@user_attribute_model.update_attributes(params[:user_role_model])
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to :action => :index }
|
||||
format.js { render 'admin/user_attribute_models/toggle_enable' }
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user_attribute_model = UserRoleModel.find(params[:id])
|
||||
@user_attribute_model.destroy
|
||||
|
||||
@user_attribute_model.destroy_i18n_variables
|
||||
|
||||
redirect_to :action => :index
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def set_attribute
|
||||
@attribute = 'role'
|
||||
@class = 'roles'
|
||||
end
|
||||
|
||||
end
|
||||
@@ -10,25 +10,18 @@ class Admin::UsersController < ApplicationController
|
||||
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
get_info_role_models
|
||||
get_info_and_roles
|
||||
end
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
get_info_role_models
|
||||
get_info_and_roles
|
||||
end
|
||||
|
||||
def create
|
||||
puts params.to_yaml
|
||||
@user = User.new(params[:user])
|
||||
if @user.save
|
||||
@user.user_infos.each do |user_info|
|
||||
user_info.save
|
||||
user_info.attribute_values.each(&:save)
|
||||
end
|
||||
@user.user_roles.each do |user_role|
|
||||
user_role.save
|
||||
user_role.attribute_values.each(&:save)
|
||||
end
|
||||
flash[:notice] = t('admin.create_success_user')
|
||||
redirect_to :action => :index
|
||||
else
|
||||
@@ -38,7 +31,7 @@ class Admin::UsersController < ApplicationController
|
||||
|
||||
def edit
|
||||
@user = User.find(params[:id])
|
||||
get_info_role_models
|
||||
get_info_and_roles
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -55,7 +48,7 @@ class Admin::UsersController < ApplicationController
|
||||
flash[:notice] = t('admin.update_success_user')
|
||||
redirect_to :action => :index
|
||||
else
|
||||
get_info_role_models
|
||||
get_info_and_roles
|
||||
render :action => :edit
|
||||
end
|
||||
end
|
||||
@@ -66,10 +59,6 @@ class Admin::UsersController < ApplicationController
|
||||
else
|
||||
@user = User.find(params[:id])
|
||||
@user.destroy
|
||||
@user.user_attributes.each do |ua|
|
||||
ua.attribute_values.each(&:destroy)
|
||||
ua.destroy
|
||||
end
|
||||
end
|
||||
|
||||
redirect_to :action => :index
|
||||
@@ -77,11 +66,11 @@ class Admin::UsersController < ApplicationController
|
||||
|
||||
protected
|
||||
|
||||
def get_info_role_models
|
||||
@user_info_models = UserInfoModel.excludes('disabled' => true)
|
||||
@user_role_models = UserRoleModel.excludes('disabled' => true)
|
||||
def get_info_and_roles
|
||||
@infos = Info.excludes('disabled' => true)
|
||||
@roles = Role.excludes('disabled' => true)
|
||||
end
|
||||
|
||||
|
||||
def set_attribute
|
||||
@class = 'users'
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user