permissify 0.0.4 → 0.0.5

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.
@@ -5,6 +5,8 @@ module Permissify
5
5
 
6
6
  def generate_ability
7
7
  copy_file "ability.rb", "app/models/ability.rb"
8
+ empty_directory "app/models/system_fixtures"
9
+ copy_file "abilities.rb", "app/models/system_fixtures/abilities.rb"
8
10
  end
9
11
  end
10
12
  end
@@ -0,0 +1,83 @@
1
+ module SystemFixtures::Abilities
2
+ def seed
3
+ TODO_SPECIFY_SYSTEM_ABILITIES_IN_APP_MODELS_SYSTEM_FIXTURES_ABILITIES
4
+ # and remember to trigger in seed process by including, for example, Ability.seed in your db/seed.rb file
5
+ # allows you to organize permissions into categories that correspond to your client's/product team's view of the system
6
+ # { 'Marketing Campaign Templates' => 'PS Admin Portal',
7
+ # 'Product Configurations' => 'PS Admin Portal',
8
+ # 'PS Marketings' => 'PS Admin Portal',
9
+ # 'Roles and Permissions' => 'PS Admin Portal',
10
+ # 'Dealer User Management' => 'PS Admin Portal',
11
+ # 'Information and Contact' => 'Branch and Location Portals : Settings',
12
+ # 'Branch User Management' => 'Branch and Location Portals : Settings',
13
+ # 'Product Types' => 'Branch and Location Portals : Settings',
14
+ # 'Marketing Campaigns' => 'Branch and Location Portals : Marketing Engine',
15
+ # 'Landing Pages' => 'Branch and Location Portals : Marketing Engine',
16
+ # 'Offers and Incentives' => 'Branch and Location Portals : Marketing Engine',
17
+ # 'Loyalty ID' => 'Branch and Location Portals : Loyalty Application',
18
+ # 'Reservation Book' => 'Branch and Location Portals : Reservation Application',
19
+ # 'Reservation General Settings' => 'Branch and Location Portals : Reservation Application',
20
+ # 'Restaurant Exception Days' => 'Branch and Location Portals : Reservation Application',
21
+ # 'Restaurant Messaging and Notifications' => 'Branch and Location Portals : Reservation Application',
22
+ # 'Restaurant Profile' => 'Branch and Location Portals : Web Page',
23
+ # 'Restaurant Website CSS' => 'Branch and Location Portals : Web Page',
24
+ # 'Restaurant Website Images' => 'Branch and Location Portals : Web Page',
25
+ # 'Web Page Analytics' => 'Branch and Location Portals : Web Page',
26
+ # 'Customer Profiles' => 'Branch and Location Portals : Customer Profiles',
27
+ # 'Corporate Portal' => 'Corporate Portal',
28
+ # 'Corporate User Management' => 'Corporate Portal',
29
+ # 'Brand Portal' => 'Brand Portal',
30
+ # 'Brand User Management' => 'Brand Portal',
31
+ # }.each{ |category, section| add_category(category, section) }
32
+ #
33
+ # add_category('Restaurant Dashboard', 'PS Admin Portal', ['Role'], 'View')
34
+ # add_category('SMS', 'Branch and Location Portals : Settings', %w(Product Role))
35
+ # add('sms_send', 'SMS', 'Branch and Location Portals : Settings', 'Send Test Message', %w(Product Role), 1, 4, [false])
36
+ # add_category('Email', 'Branch and Location Portals : Settings', %w(Product Role))
37
+ # add('email_limit', 'Email', 'Branch and Location Portals : Settings', 'Send', %w(Product Role), 2, 4, [false,0], " up to ***1:text:9** Emails")
38
+ #
39
+ # add_category('Transactional Templates', 'PS Admin Portal', ['Role'], %w(create view delete updatemerchant updateadmin updatedealer))
40
+ # add_category('Administrative Settings', 'PS Admin Portal', ['Role'], %w(update))
41
+ #
42
+ # add_category('Social Media', 'Branch and Location Portals : Social Media', %w(Product Role), %w(FacebookConnect TwitterConnect WebsiteConnect SocialFeedback Reports))
43
+ # add_category('Social Media Posts', 'Branch and Location Portals : Social Media', %w(Product Role))
44
+ # %w(Contact Home Menu Press WhatsNew).each do |name|
45
+ # add_category("Web Pages : #{name}", 'Branch and Location Portals : Web Page', %w(Product Role))
46
+ # end
47
+ #
48
+ # ['Marketing Engine', 'Online Ordering', 'Loyalty', 'Webpage Builder', 'eGift', 'Guest Management', 'Mobile Marketing', 'Offers and Incentives'].each do |feature_bit|
49
+ # add_category(feature_bit, 'Solutions', %w(Product), %w(On))
50
+ # end
51
+ # add_category('Online Reservations', 'Solutions', %w(Product), %w(Integrated Standalone))
52
+ #
53
+ # add_category('GM Application Roles', 'Guest Management', %w(Role), %w(ApplicationAdmin StoreAdmin Host), :one_or_none)
54
+ #
55
+ # add_category('OO Roles', 'Online Ordering', %w(Role), %w(MerchantManager ReportManager CallCenterEmployee), :one_or_none)
56
+ # add_category('Report Manager User Rights', 'Online Ordering', %w(Role), %w(ConsoleUser MercuryPaymentsEdit StoreManager VoidOrder TransferOrder))
57
+ #
58
+ # add_category('eGift Roles', 'eGift', %w(Role), %w(Admin Staff Merchant), :one_or_none)
59
+ # add_category('eGift Rights', 'eGift', %w(Role), %w(SalesPageOption GiftCards EmailCampaign SystemVariables SiteContent IPRestriction PaymentConfiguration NewMerchant Reports Search))
60
+ #
61
+ # add_category('Store ID', 'Branch and Location Portals : Settings', ['Role'], 'View')
62
+ #
63
+ # add_category('POS API Key', 'Branch and Location Portals : Settings', ['Role'], 'Generate')
64
+ #
65
+ # add_category('Opt-in Opt-out', 'Branch and Location Portals : Customer Profiles', ['Role'], %w(opt-in opt-out))
66
+ #
67
+ # ['Branch and Location Portals : Settings', 'Brand Portal', 'Corporate Portal'].each do |section|
68
+ # add_category("#{section.split(' ').first} Zoura Account", section, ['Role'], 'Update')
69
+ # end
70
+ #
71
+ # add('offers_and_incentives_redeem', 'Offers and Incentives', 'Branch and Location Portals : Marketing Engine', 'Redeem', %w(Product Role), 1, 4, [false])
72
+ end
73
+
74
+ # TODO : keep following methods here or move into ability.rb?
75
+ def add_category(category, section, applicability=['Role'], actions=%w(View Create Update Delete), category_allows = :multiple)
76
+ actions = [actions] unless actions.kind_of?(Array)
77
+ actions.collect do |action|
78
+ add("#{key_token(category)}_#{key_token(action)}", category, section, action, applicability, 1, actions.index(action)+1, [false], '', category_allows)
79
+ end
80
+ end
81
+
82
+ def key_token(token); token.downcase.gsub('-','_').gsub(':','').gsub(' ',' ').gsub(' ','_'); end
83
+ end
@@ -1,4 +1,4 @@
1
- module PermissifiedController
1
+ module PermissifiedController # Interface : override/rewrite as needed for your app
2
2
 
3
3
  # app-specific consideration for whether operating on a
4
4
  # merchant/business, brand, corporation, dealer or
@@ -1,19 +1,8 @@
1
1
  module Permissify
2
- module Controller # Interface : override/rewrite as needed
3
-
4
- # is this going to work?
5
- # generator creates app/controllers/permissified_controller.rb
6
- # - if not, remedy by having both Permissify::Controller and PermissifedController in application_controller?
7
- include PermissifiedController
8
-
9
- def current_entity # merchant/business, brand, corporation, dealer or special case (all? none? products) for admin
10
- return @current_entity if @current_entity
11
- TODO_IMPLEMENT_PERMISSIFY_CONTROLLER_CURRENT_ENTITY_INTERFACE_METHOD
12
- nil
13
- end
14
-
2
+ module Controller
3
+
15
4
  def domain_permissions
16
- return entity.permissions_union if current_user.nil? # public pages allow corp/brand/merchant product permissions
5
+ return current_entity.permissions_union if current_user.nil? # public pages allow corp/brand/merchant product permissions
17
6
  return current_user.permissions_union unless current_entity # admin, by convention, not subscribed to any products
18
7
  current_user.permissions_intersection(current_entity.permissions_union)
19
8
  end
@@ -1,4 +1,4 @@
1
- module Permissions::Roles
1
+ module Permissify::Roles
2
2
  include Permissify::Aggregate
3
3
 
4
4
  def primary_domain_type; sorted_domain_types.first; end
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Frederick Fix
@@ -59,6 +59,7 @@ extra_rdoc_files: []
59
59
 
60
60
  files:
61
61
  - lib/generators/permissify/ability/ability_generator.rb
62
+ - lib/generators/permissify/ability/template/abilities.rb
62
63
  - lib/generators/permissify/ability/template/ability.rb
63
64
  - lib/generators/permissify/ability/USAGE
64
65
  - lib/generators/permissify/controller/controller_generator.rb