permissify 0.0.18 → 0.0.19
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.
- data/lib/generators/permissify/ability/template/abilities.rb +6 -2
- data/lib/generators/permissify/controller/template/permissions_controller.rb +1 -0
- data/lib/generators/permissify/role/template/role.rb +1 -1
- data/lib/generators/permissify/views/template/permissions/_aggregate_permissions.html.erb +0 -1
- data/lib/generators/permissify/views/template/permissions/_model_permissions.html.erb +0 -2
- data/lib/generators/permissify/views/template/permissions_helper.rb +1 -1
- data/lib/permissify/ability_class.rb +4 -0
- data/lib/permissify/union.rb +4 -0
- metadata +4 -4
@@ -12,13 +12,17 @@ module SystemFixtures::Abilities
|
|
12
12
|
# This is a name coupling (see Permissify::Union) that can be overriden.
|
13
13
|
|
14
14
|
# applies_to_users_only = [User::PERMISSIFIED_ABILITY_APPLICABILITY]
|
15
|
-
# add_category('Tabs', 'Tabs', applies_to_users_only, %w(Admin
|
15
|
+
# add_category('Tabs', 'Tabs', applies_to_users_only, %w(Admin Dealers Corporations Brands Merchants))
|
16
16
|
# { 'Roles' => 'Admin',
|
17
17
|
# 'Admin Users' => 'Admin',
|
18
|
+
# 'Dealers' => 'Dealer Admin',
|
18
19
|
# 'Dealer Users' => 'Dealer Admin',
|
19
|
-
# '
|
20
|
+
# 'Corporation Users' => 'Corporation Admin',
|
21
|
+
# 'Corporations' => 'Corporation Admin',
|
20
22
|
# 'Brand Users' => 'Brand Admin',
|
23
|
+
# 'Brands' => 'Brand Admin',
|
21
24
|
# 'Merchant Users' => 'Merchant Admin',
|
25
|
+
# 'Merchants' => 'Merchant Admin',
|
22
26
|
# }.each{ |category, section| add_category(category, section, applies_to_users_only) }
|
23
27
|
end
|
24
28
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
<% category_permissions.each do |@permission| %>
|
2
|
-
<% next if (@permission[:key] == 'corporate_portal_delete') || (@permission[:key] == 'brand_portal_delete') %>
|
3
2
|
<%- mthp = models_that_have_permission %>
|
4
3
|
<a href='#' title='<%=mthp%>' style='color:<%= mthp == 'none' ? 'red':'green' %>'>
|
5
4
|
<%= @permission[:action] %>
|
@@ -1,11 +1,9 @@
|
|
1
1
|
<% category_permissions.each do |@permission| %>
|
2
|
-
<% next if (@permission[:key] == 'corporate_portal_delete') || (@permission[:key] == 'brand_portal_delete') %>
|
3
2
|
<%= render :partial => 'permissions/color_coded_permission' %>
|
4
3
|
<% end %>
|
5
4
|
<table id="<%=category_name%>" style="display:none;">
|
6
5
|
<tbody>
|
7
6
|
<% category_permissions.each do |@permission| %>
|
8
|
-
<% next if (@permission[:key] == 'corporate_portal_delete') || (@permission[:key] == 'brand_portal_delete') %>
|
9
7
|
<%= render :partial => 'permissions/permission' %>
|
10
8
|
<% end %>
|
11
9
|
</tbody>
|
@@ -27,6 +27,10 @@ module Permissify
|
|
27
27
|
all.select{ |ability| ability[:key] == key }.first
|
28
28
|
end
|
29
29
|
|
30
|
+
def actions(category_prefix)
|
31
|
+
all.collect{|a| a[:action] if a[:key].start_with?("#{key_token(category_prefix)}_")}.compact
|
32
|
+
end
|
33
|
+
|
30
34
|
def add(category, section, action, applicability, requires_any_or_all, number_of_values, position, default_values, admin_expression='', category_allows = :multiple)
|
31
35
|
applicability = applicability.to_set
|
32
36
|
@@abilities << { :key => key_for(action, category), :category => category, :section => section, :action => action,
|
data/lib/permissify/union.rb
CHANGED
@@ -3,6 +3,10 @@ module Permissify
|
|
3
3
|
|
4
4
|
include Permissify::Common
|
5
5
|
|
6
|
+
def permissions
|
7
|
+
@union ||= construct_union
|
8
|
+
end
|
9
|
+
|
6
10
|
def permission(action, category) # interface used by Permissify::Common.allowed_to?
|
7
11
|
@union ||= construct_union # TODO : get lazier?
|
8
12
|
permissible?(@union, action, category)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: permissify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 57
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 19
|
10
|
+
version: 0.0.19
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Frederick Fix
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-06-
|
18
|
+
date: 2012-06-18 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|