activeaclplus 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -304,7 +304,7 @@ is/will be setup at http://github.com/popel/active_acl_plus_rspec/tree/master .
304
304
 
305
305
  in no particular order, just a reminder...
306
306
 
307
- * add materialized_tree_support
307
+ * add materialized_tree support
308
308
  * use Moneta as key/value store
309
309
  * direct PostgreSQL interface
310
310
  * example on how to integrate with authentication
@@ -44,6 +44,7 @@ module ActiveAcl #:nodoc:
44
44
  #todo check cash l2
45
45
 
46
46
  vars={'requester_id' => requester.id}
47
+ vars['requester_group_id'] = requester.send(association_foreign_key) if !self.habtm? && self.grouped?
47
48
  sql = ''
48
49
  sql << query_r_select
49
50
  if target
@@ -56,10 +57,11 @@ module ActiveAcl #:nodoc:
56
57
  sql << "\n ORDER BY "
57
58
 
58
59
  #TODO: ordering is a mess (use an array?)
59
- order = (grouped? ? order_by_3d : [])
60
+ order = (grouped? ? order_by_3d.dup : [])
60
61
  if t_handler.grouped?
61
62
  order << "(CASE WHEN t_g_links.acl_id IS NULL THEN 0 ELSE 1 END) ASC"
62
63
  order << t_handler.group_handler.order_by(target,true)
64
+ vars['target_group_id'] = target.send(t_handler.association_foreign_key) unless t_handler.habtm?
63
65
  end
64
66
  order << 'acls.updated_at DESC'
65
67
  sql << order.join(',')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeaclplus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Schrammel
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-03-04 00:00:00 +01:00
13
+ date: 2009-03-09 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -68,13 +68,6 @@ files:
68
68
  - app/models/active_acl/target_link.rb
69
69
  - app/models/active_acl/controller_action.rb
70
70
  - app/models/active_acl/acl.rb
71
- - app/controllers
72
- - app/controllers/privileges_controller.rb
73
- - app/view
74
- - app/view/privileges
75
- - app/view/privileges/list.rhtml
76
- - app/view/privileges/edit.rhtml
77
- - app/view/privileges/_privilege_form.rhtml
78
71
  - init.rb
79
72
  - install.rb
80
73
  - Rakefile
@@ -109,6 +102,6 @@ rubyforge_project: activeaclplus
109
102
  rubygems_version: 1.3.1
110
103
  signing_key:
111
104
  specification_version: 2
112
- summary: A new Version (0.4.0) of ActiveAclPlus is available.
105
+ summary: A new Version (0.4.2) of ActiveAclPlus is available.
113
106
  test_files: []
114
107
 
@@ -1,55 +0,0 @@
1
- class PrivilegesController < ApplicationController
2
- verify :method => :post, :only => [ :create, :update],
3
- :redirect_to => { :action => :list }
4
-
5
- def index
6
- redirect_to :action => :list
7
- end
8
-
9
- def list
10
- @privileges = ActiveAcl::Privilege.find(:all, :order => 'section ASC, value ASC')
11
- end
12
-
13
- def edit
14
- redirect_to :action => :list and return false unless params[:id]
15
- begin
16
- @privilege = ActiveAcl::Privilege.find(params[:id])
17
- rescue ActiveRecord::RecordNotFound => e
18
- flash[:error] = 'Privilege not found'
19
- redirect_to :action => :list and return false
20
- end
21
- end
22
-
23
- def update
24
- redirect_to :action => :list and return false if params['commit'] == 'Cancel'
25
-
26
- begin
27
- @privilege = ActiveAcl::Privilege.find(params[:id].to_i)
28
- rescue ActiveRecord::RecordNotFound => e
29
- flash[:error] = 'Privilege not found'
30
- redirect_to :action => :list and return false
31
- end
32
-
33
- if (@privilege.update_attributes(params[:privilege]))
34
- flash[:success] = 'Privilege successfully updated'
35
- redirect_to :action => :list and return false
36
- else
37
- flash.now[:error] = 'There was an error updating the Privilege'
38
- @title = 'Edit Privilege'
39
- render :action => :edit
40
- end
41
- end
42
-
43
- def delete
44
- redirect_to :action => :list and return false unless params[:id]
45
- begin
46
- privilege = ActiveAcl::Privilege.find(params[:id])
47
- privilege.destroy
48
- flash[:success] = 'Privilege successfully deleted'
49
- rescue ActiveRecord::RecordNotFound => e
50
- flash[:error] = 'Privilege not found'
51
- end
52
-
53
- redirect_to :action => :list and return false
54
- end
55
- end
@@ -1,14 +0,0 @@
1
- <table border="0">
2
- <tr>
3
- <td>Section:</td>
4
- <td><%= text_field 'permission', 'section' %></td>
5
- </tr>
6
- <tr>
7
- <td>Value:</td>
8
- <td><%= text_field 'permission', 'value' %></td>
9
- </tr>
10
- <tr>
11
- <td>Description:</td>
12
- <td><%= text_field 'permission', 'description' %></td>
13
- </tr>
14
- </table>
@@ -1,17 +0,0 @@
1
- <html>
2
- <body>
3
- <% if flash[:error] %>
4
- <p class="error"><%=h flash[:error] %></p>
5
- <% elsif flash[:notice] %>
6
- <p class="notice"><%=h flash[:notice] %></p>
7
- <% elsif flash[:success] %>
8
- <p class="notice"><%=h flash[:success] %></p>
9
- <% else %>
10
- <p>&nbsp;</p>
11
- <% end %>
12
- <%= form_tag({ :action => 'update', :id => @permission.id }) %>
13
- <%= render_partial 'permission_form' %>
14
- <%= submit_tag 'Save' %> <%= submit_tag 'Cancel' %>
15
- </form>
16
- </body>
17
- </html>
@@ -1,39 +0,0 @@
1
- <html>
2
- <body>
3
- <% if flash[:error] %>
4
- <p class="error"><%=h flash[:error] %></p>
5
- <% elsif flash[:notice] %>
6
- <p class="notice"><%=h flash[:notice] %></p>
7
- <% elsif flash[:success] %>
8
- <p class="notice"><%=h flash[:success] %></p>
9
- <% else %>
10
- <p>&nbsp;</p>
11
- <% end %>
12
- <table border="0" cellpadding="5">
13
- <tr>
14
- <th>Section/Value</th>
15
- <th>Description</th>
16
- <th>&nbsp;</th>
17
- </tr>
18
- <% oldsection = nil %>
19
- <% for permission in @permissions do %>
20
- <% if permission.section != oldsection and oldsection != nil %>
21
- <tr><td colspan="3">&nbsp;</td></tr>
22
- <% end %>
23
- <% unless permission.section == oldsection %>
24
- <tr>
25
- <td colspan="3"><b><%=h permission.section %></b></td>
26
- </tr>
27
- <% oldsection = permission.section %>
28
- <% end %>
29
- <tr>
30
- <td><img src="/engine_files/gacl_engine/spacer.gif" height="1" width="20"><%= link_to permission.value, :action => 'edit', :id => permission.id %></td>
31
- <td><%=h permission.description %></td>
32
- <td>
33
- <small>[<%= link_to 'delete', {:action => 'delete', :id => permission.id }, {:confirm => 'Shure to delete this Permission?'} %>]</small>
34
- </td>
35
- </tr>
36
- <% end %>
37
- </table>
38
- </body>
39
- </html>