add "all_user" for app&object auth

This commit is contained in:
Matthew Kaito Juyuan Fu 2012-02-16 14:59:26 +08:00
parent d2689bc59c
commit 9305c2045c
3 changed files with 15 additions and 4 deletions

View File

@ -21,7 +21,10 @@ class Admin::AppAuthsController < ApplicationController
def create def create
app_auth = AppAuth.find_or_create_by(module_app_id: params[:module_app_id]) app_auth = AppAuth.find_or_create_by(module_app_id: params[:module_app_id])
params[:new].each do |item| auth_all = params[:auth_all] || false
app_auth.update_attribute(:all,auth_all)
new_array = params[:new] || []
new_array.each do |item|
field = item[0] field = item[0]
field_value = item[1] field_value = item[1]
if field_value!='' if field_value!=''

View File

@ -33,7 +33,10 @@ class Admin::ObjectAuthsController < ApplicationController
def create_role def create_role
object_auth = ObjectAuth.find(params[:id]) object_auth = ObjectAuth.find(params[:id])
params[:new].each do |item| auth_all = params[:auth_all] || false
object_auth.update_attribute(:all,auth_all)
new_array = params[:new] || []
new_array.each do |item|
field = item[0] field = item[0]
field_value = item[1] field_value = item[1]
if field_value!='' if field_value!=''

View File

@ -1,7 +1,12 @@
<div id="open_for_all_user">
<h1>All User</h1>
<%= form_tag(submit_url) do %>
<%= check_box_tag 'auth_all',true,auth.all %><%= submit_tag 'Add Role' %><br/>
<% end %>
</div>
<div id="user_role_management"> <div id="user_role_management">
<h1>User Role</h1> <h1>User Role</h1>
All User
<%= form_tag(submit_url) do %> <%= form_tag(submit_url) do %>
<%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %> <%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %>
<%= submit_tag 'Add Role' %><br/> <%= submit_tag 'Add Role' %><br/>