erp_tech_svcs 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. data/app/models/capability.rb +4 -0
  2. data/lib/erp_tech_svcs/extensions/active_record/has_file_assets.rb +4 -0
  3. data/lib/erp_tech_svcs/extensions/active_record/protected_with_capabilities.rb +7 -1
  4. data/lib/erp_tech_svcs/version.rb +1 -1
  5. metadata +2 -38
  6. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +0 -15
  7. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
  8. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
  9. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
  10. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
  11. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
  12. data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +0 -14
  13. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
  14. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +0 -24
  15. data/spec/dummy/db/migrate/20130107214445_base_erp_services.erp_base_erp_svcs.rb +0 -461
  16. data/spec/dummy/db/migrate/20130107214446_base_tech_services.erp_tech_svcs.rb +0 -271
  17. data/spec/dummy/db/migrate/20130107214447_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
  18. data/spec/dummy/db/migrate/20130107214448_create_groups.erp_tech_svcs.rb +0 -19
  19. data/spec/dummy/db/migrate/20130107214449_upgrade_security.erp_tech_svcs.rb +0 -54
  20. data/spec/dummy/db/migrate/20130107214450_upgrade_security2.erp_tech_svcs.rb +0 -270
  21. data/spec/dummy/db/schema.rb +0 -613
  22. data/spec/dummy/db/spec.sqlite3 +0 -0
  23. data/spec/dummy/log/spec.log +0 -22016
@@ -32,6 +32,10 @@ class Capability < ActiveRecord::Base
32
32
  where("capability_accessors.id IS NULL")
33
33
  end
34
34
 
35
+ def remove_all_roles
36
+ capability_accessors.destroy_all
37
+ end
38
+
35
39
  def roles
36
40
  SecurityRole.joins(:capability_accessors).where(:capability_accessors => {:capability_id => self.id })
37
41
  end
@@ -46,6 +46,10 @@ module ErpTechSvcs
46
46
  self.files.where('type = ?', 'Template')
47
47
  end
48
48
 
49
+ def stylesheets
50
+ self.files.where('type = ?', 'Stylesheet')
51
+ end
52
+
49
53
  def pdfs
50
54
  self.files.where('type = ?', 'Pdf')
51
55
  end
@@ -178,7 +178,13 @@ module ErpTechSvcs
178
178
  capability = Capability.find_or_create_by_capability_resource_type_and_capability_resource_id_and_capability_type_id_and_scope_type_id(get_superclass, self.id, capability_type.id, scope_type.id)
179
179
  self.reload
180
180
  capability
181
- end
181
+ end
182
+
183
+ def roles
184
+ SecurityRole.joins(:capability_accessors => :capability)
185
+ .where(:capabilities => {:capability_resource_type => self.class.name})
186
+ .where(:capabilities => {:capability_resource_id => self.id})
187
+ end
182
188
 
183
189
  def protect_with_capability(capability_type_iid)
184
190
  add_capability(capability_type_iid)
@@ -2,7 +2,7 @@ module ErpTechSvcs
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 3
4
4
  MINOR = 1
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erp_tech_svcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-25 00:00:00.000000000 Z
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erp_base_erp_svcs
@@ -256,24 +256,6 @@ files:
256
256
  - spec/dummy/config/routes.rb
257
257
  - spec/dummy/config/s3.yml
258
258
  - spec/dummy/config.ru
259
- - spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb
260
- - spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb
261
- - spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb
262
- - spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb
263
- - spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb
264
- - spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb
265
- - spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb
266
- - spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb
267
- - spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb
268
- - spec/dummy/db/migrate/20130107214445_base_erp_services.erp_base_erp_svcs.rb
269
- - spec/dummy/db/migrate/20130107214446_base_tech_services.erp_tech_svcs.rb
270
- - spec/dummy/db/migrate/20130107214447_create_has_attribute_tables.erp_tech_svcs.rb
271
- - spec/dummy/db/migrate/20130107214448_create_groups.erp_tech_svcs.rb
272
- - spec/dummy/db/migrate/20130107214449_upgrade_security.erp_tech_svcs.rb
273
- - spec/dummy/db/migrate/20130107214450_upgrade_security2.erp_tech_svcs.rb
274
- - spec/dummy/db/schema.rb
275
- - spec/dummy/db/spec.sqlite3
276
- - spec/dummy/log/spec.log
277
259
  - spec/dummy/move_test_tmp/file_asset_spec_text.txt
278
260
  - spec/dummy/public/404.html
279
261
  - spec/dummy/public/422.html
@@ -341,24 +323,6 @@ test_files:
341
323
  - spec/dummy/config/routes.rb
342
324
  - spec/dummy/config/s3.yml
343
325
  - spec/dummy/config.ru
344
- - spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb
345
- - spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb
346
- - spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb
347
- - spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb
348
- - spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb
349
- - spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb
350
- - spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb
351
- - spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb
352
- - spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb
353
- - spec/dummy/db/migrate/20130107214445_base_erp_services.erp_base_erp_svcs.rb
354
- - spec/dummy/db/migrate/20130107214446_base_tech_services.erp_tech_svcs.rb
355
- - spec/dummy/db/migrate/20130107214447_create_has_attribute_tables.erp_tech_svcs.rb
356
- - spec/dummy/db/migrate/20130107214448_create_groups.erp_tech_svcs.rb
357
- - spec/dummy/db/migrate/20130107214449_upgrade_security.erp_tech_svcs.rb
358
- - spec/dummy/db/migrate/20130107214450_upgrade_security2.erp_tech_svcs.rb
359
- - spec/dummy/db/schema.rb
360
- - spec/dummy/db/spec.sqlite3
361
- - spec/dummy/log/spec.log
362
326
  - spec/dummy/move_test_tmp/file_asset_spec_text.txt
363
327
  - spec/dummy/public/404.html
364
328
  - spec/dummy/public/422.html
@@ -1,15 +0,0 @@
1
- # This migration comes from erp_tech_svcs (originally 20110109173616)
2
- class CreateCapabilityScopeTypes
3
-
4
- def self.up
5
- CapabilityType.create(:internal_identifier => 'download', :description => 'Download') if CapabilityType.where("internal_identifier = 'download'").first.nil?
6
-
7
- ScopeType.create(:description => 'Instance', :internal_identifier => 'instance') if ScopeType.where("internal_identifier = 'instance'").first.nil?
8
- ScopeType.create(:description => 'Class', :internal_identifier => 'class') if ScopeType.where("internal_identifier = 'class'").first.nil?
9
- ScopeType.create(:description => 'Query', :internal_identifier => 'query') if ScopeType.where("internal_identifier = 'query'").first.nil?
10
- end
11
-
12
- def self.down
13
- end
14
-
15
- end
@@ -1,12 +0,0 @@
1
- # This migration comes from erp_base_erp_svcs (originally 20110525001935)
2
- class AddUsdCurrency
3
-
4
- def self.up
5
- Currency.create(:name => 'US Dollar', :internal_identifier => 'USD', :major_unit_symbol => "$")
6
- end
7
-
8
- def self.down
9
- Currency.usd.destroy
10
- end
11
-
12
- end
@@ -1,19 +0,0 @@
1
- # This migration comes from erp_base_erp_svcs (originally 20110609150135)
2
- require 'yaml'
3
-
4
- class AddIsoCodes
5
-
6
- def self.up
7
- #find the erp_base_erp_svcs engine
8
- engine_path = Rails::Application::Railties.engines.find{|item| item.engine_name == 'erp_base_erp_svcs'}.config.root.to_s
9
-
10
- GeoCountry.load_from_file(File.join(engine_path,'db/data_sets/geo_countries.yml'))
11
- GeoZone.load_from_file(File.join(engine_path,'db/data_sets/geo_zones.yml'))
12
- end
13
-
14
- def self.down
15
- GeoCountry.delete_all
16
- GeoZone.delete_all
17
- end
18
-
19
- end
@@ -1,16 +0,0 @@
1
- # This migration comes from erp_tech_svcs (originally 20110802200222)
2
- class ScheduleDeleteExpiredSessionsJob
3
-
4
- def self.up
5
- #insert data here
6
- date = Date.tomorrow
7
- start_time = DateTime.civil(date.year, date.month, date.day, 2, 0, 1, -(5.0/24.0))
8
-
9
- ErpTechSvcs::Sessions::DeleteExpiredSessionsJob.schedule_job(start_time)
10
- end
11
-
12
- def self.down
13
- #remove data here
14
- end
15
-
16
- end
@@ -1,12 +0,0 @@
1
- # This migration comes from erp_base_erp_svcs (originally 20110913145838)
2
- class SetupCompassAeInstance
3
-
4
- def self.up
5
- CompassAeInstance.create(version: 3.1)
6
- end
7
-
8
- def self.down
9
- #remove data here
10
- end
11
-
12
- end
@@ -1,22 +0,0 @@
1
- # This migration comes from erp_tech_svcs (originally 20111111144706)
2
- class SetupAuditLogTypes
3
-
4
- def self.up
5
- application_alt = AuditLogType.create(:description => 'Application', :internal_identifier => 'application')
6
-
7
- [
8
- {:description => 'Custom Message', :internal_identifier => 'custom_message'},
9
- {:description => 'Successful Logout', :internal_identifier => 'successful_logout'},
10
- {:description => 'Successful Login', :internal_identifier => 'successful_login'},
11
- {:description => 'Accessed Area', :internal_identifier => 'accessed_area'},
12
- {:description => 'Session Timeout', :internal_identifier => 'session_timeout'}
13
- ].each do |alt_hash|
14
- AuditLogType.create(alt_hash).move_to_child_of(application_alt)
15
- end
16
- end
17
-
18
- def self.down
19
- AuditLogType.destroy_all
20
- end
21
-
22
- end
@@ -1,14 +0,0 @@
1
- # This migration comes from erp_tech_svcs (originally 20120109173616)
2
- class CreateDownloadCapabilityType
3
-
4
- def self.up
5
- CapabilityType.create(:internal_identifier => 'download', :description => 'Download')
6
- Role.create(:description => 'File Downloader', :internal_identifier => 'file_downloader')
7
- end
8
-
9
- def self.down
10
- CapabilityType.where("internal_identifier = 'download'").first.destroy unless Role.where("internal_identifier = 'download'").first.nil?
11
- Role.where("internal_identifier = 'file_downloader'").first.destroy unless Role.where("internal_identifier = 'file_downloader'").first.nil?
12
- end
13
-
14
- end
@@ -1,20 +0,0 @@
1
- # This migration comes from erp_tech_svcs (originally 20121116155018)
2
- class CreateGroupRelationshipAndRoleTypes
3
-
4
- def self.up
5
- #insert data here
6
- to_role = RoleType.create(:description => 'Security Group', :internal_identifier => 'group')
7
- from_role = RoleType.create(:description => 'Security Group Member', :internal_identifier => 'group_member')
8
- RelationshipType.create(:description => 'Security Group Membership',
9
- :name => 'Group Membership',
10
- :internal_identifier => 'group_membership',
11
- :valid_from_role => from_role,
12
- :valid_to_role => to_role
13
- )
14
- end
15
-
16
- def self.down
17
- #remove data here
18
- end
19
-
20
- end
@@ -1,24 +0,0 @@
1
- # This migration comes from erp_tech_svcs (originally 20121130212146)
2
- class NoteCapabilities
3
-
4
- def self.up
5
- #insert data here
6
- admin = SecurityRole.find_or_create_by_description_and_internal_identifier(:description => 'Admin', :internal_identifier => 'admin')
7
- employee = SecurityRole.find_or_create_by_description_and_internal_identifier(:description => 'Employee', :internal_identifier => 'employee')
8
-
9
- admin.add_capability('create', 'Note')
10
- admin.add_capability('delete', 'Note')
11
- admin.add_capability('edit', 'Note')
12
- admin.add_capability('view', 'Note')
13
-
14
- employee.add_capability('create', 'Note')
15
- employee.add_capability('delete', 'Note')
16
- employee.add_capability('edit', 'Note')
17
- employee.add_capability('view', 'Note')
18
- end
19
-
20
- def self.down
21
- #remove data here
22
- end
23
-
24
- end