permissify 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 Dealer Corporate Brand Merchant))
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
- # 'Corporate Users' => 'Corporate Admin',
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
 
@@ -72,5 +72,6 @@ class PermissionsController < ApplicationController
72
72
  @active_tab = 'admin'
73
73
  @active_section = 'Admin'
74
74
  @active_nav = 'Roles'
75
+ @current_entity = @entity = Admin.first
75
76
  end
76
77
  end
@@ -1,5 +1,5 @@
1
1
  class Role < ActiveRecord::Base
2
- DOMAIN_TYPES = %w(Admin Dealer Corporate Brand Merchant)
2
+ DOMAIN_TYPES = %w(Admin Dealer Corporation Brand Merchant)
3
3
  # DOMAIN_TYPES = %w(Admin Operations CallCenter)
4
4
  include Permissify::Model
5
5
  # is_paranoid
@@ -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>
@@ -69,7 +69,7 @@ module PermissionsHelper
69
69
  { 'role' => [ 'Tabs',
70
70
  'Admin',
71
71
  'Dealer Admin',
72
- 'Corporate Admin',
72
+ 'Corporation Admin',
73
73
  'Brand Admin',
74
74
  'Merchant Admin'
75
75
  ],
@@ -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,
@@ -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: 59
4
+ hash: 57
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 18
10
- version: 0.0.18
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-13 00:00:00 Z
18
+ date: 2012-06-18 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rspec