erp_app 3.1.11 → 3.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/erp_app/desktop/tail/base_controller.rb +33 -0
- data/config/routes.rb +3 -0
- data/db/data_migrations/20130703181549_create_tail_desktop_application.rb +22 -0
- data/lib/erp_app/version.rb +1 -1
- data/public/javascripts/erp_app/desktop/applications/tail/module.js +36 -0
- data/public/javascripts/erp_app/desktop/applications/tail/tail_panel.js +145 -0
- data/public/javascripts/erp_app/mobile/applications/job_tracker/view/templates.js +16 -16
- data/public/stylesheets/erp_app/shared/compass-ext-all.css +5 -0
- data/spec/dummy/db/data_migrations/20130422163128_add_usd_currency.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/data_migrations/20130422163129_add_iso_codes.erp_base_erp_svcs.rb +19 -0
- data/spec/dummy/db/data_migrations/20130422163130_setup_compass_ae_instance.erp_base_erp_svcs.rb +21 -0
- data/spec/dummy/db/data_migrations/20130422163131_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +19 -0
- data/spec/dummy/db/data_migrations/20130422163132_add_guid_to_instances.erp_base_erp_svcs.rb +10 -0
- data/spec/dummy/db/data_migrations/20130422163133_create_capability_scope_types.erp_tech_svcs.rb +15 -0
- data/spec/dummy/db/data_migrations/20130422163134_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
- data/spec/dummy/db/data_migrations/20130422163135_setup_audit_log_types.erp_tech_svcs.rb +22 -0
- data/spec/dummy/db/data_migrations/20130422163136_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
- data/spec/dummy/db/data_migrations/20130422163137_note_capabilities.erp_tech_svcs.rb +24 -0
- data/spec/dummy/db/data_migrations/20130422163138_erp_app_setup.erp_app.rb +252 -0
- data/spec/dummy/db/data_migrations/20130422163139_update_preferences.erp_app.rb +53 -0
- data/spec/dummy/db/data_migrations/20130422163140_create_desktop_app_audit_log_viewer.erp_app.rb +24 -0
- data/spec/dummy/db/data_migrations/20130422163141_add_file_manager_application.erp_app.rb +32 -0
- data/spec/dummy/db/data_migrations/20130422163142_add_default_capabilities.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20130422163143_add_new_contact_widgets.erp_app.rb +42 -0
- data/spec/dummy/db/data_migrations/20130422163144_add_userinfo_widget.erp_app.rb +29 -0
- data/spec/dummy/db/data_migrations/20130422163145_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
- data/spec/dummy/db/data_migrations/20130422163146_create_user_management_mobile_application.erp_app.rb +17 -0
- data/spec/dummy/db/data_migrations/20130422163147_create_configuration_management_desktop_application.erp_app.rb +27 -0
- data/spec/dummy/db/data_migrations/20130422163148_create_job_tracker_desktop_application.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20130422163149_created_tracked_jobs.erp_app.rb +15 -0
- data/spec/dummy/db/data_migrations/20130422163150_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
- data/spec/dummy/db/data_migrations/20130422163151_create_security_management_desktop_application.erp_app.rb +29 -0
- data/spec/dummy/db/data_migrations/20130422163152_add_job_tracker_mobile_app.erp_app.rb +17 -0
- data/spec/dummy/db/migrate/20130422163121_base_erp_services.erp_base_erp_svcs.rb +486 -0
- data/spec/dummy/db/migrate/20130422163122_add_txn_status.erp_base_erp_svcs.rb +37 -0
- data/spec/dummy/db/migrate/20130422163123_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +34 -0
- data/spec/dummy/db/migrate/20130422163124_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +17 -0
- data/spec/dummy/db/migrate/20130422163125_add_long_lat_to_address.erp_base_erp_svcs.rb +16 -0
- data/spec/dummy/db/migrate/20130422163126_base_tech_services.erp_tech_svcs.rb +271 -0
- data/spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
- data/spec/dummy/db/migrate/20130422163128_create_groups.erp_tech_svcs.rb +19 -0
- data/spec/dummy/db/migrate/20130422163129_upgrade_security.erp_tech_svcs.rb +54 -0
- data/spec/dummy/db/migrate/20130422163130_upgrade_security2.erp_tech_svcs.rb +275 -0
- data/spec/dummy/db/migrate/20130422163131_add_queue_to_delayed_jobs.erp_tech_svcs.rb +14 -0
- data/spec/dummy/db/migrate/20130422163132_base_app_framework.erp_app.rb +276 -0
- data/spec/dummy/db/migrate/20130422163133_add_job_tracker.erp_app.rb +20 -0
- data/spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb +28 -0
- data/spec/dummy/db/schema.rb +883 -0
- data/spec/dummy/db/spec.sqlite3 +0 -0
- metadata +89 -3
@@ -0,0 +1,33 @@
|
|
1
|
+
module ErpApp
|
2
|
+
module Desktop
|
3
|
+
module Tail
|
4
|
+
class BaseController < ::ErpApp::Desktop::BaseController
|
5
|
+
|
6
|
+
def get_tail
|
7
|
+
contents = []
|
8
|
+
|
9
|
+
cursor = params[:cursor].to_i
|
10
|
+
|
11
|
+
log_file = File.join(Rails.root, 'log', "#{Rails.env}.log")
|
12
|
+
|
13
|
+
File.open(log_file) do |f|
|
14
|
+
if cursor == 0
|
15
|
+
f.seek(-1, IO::SEEK_END)
|
16
|
+
else
|
17
|
+
f.seek cursor
|
18
|
+
end
|
19
|
+
|
20
|
+
if !f.eof?
|
21
|
+
contents = f.readlines
|
22
|
+
cursor = f.tell
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
render :json => {:success => true, :tail => contents.join('<br/>'), :cursor => cursor}
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end #Tail
|
32
|
+
end #Desktop
|
33
|
+
end #ErpApp
|
data/config/routes.rb
CHANGED
@@ -73,6 +73,9 @@ ErpApp::Engine.routes.draw do
|
|
73
73
|
#audit_log_view
|
74
74
|
match '/desktop/audit_log_viewer/:action.:format' => 'desktop/audit_log_viewer/base'
|
75
75
|
|
76
|
+
#tail
|
77
|
+
match '/desktop/tail(/:action)' => "desktop/tail/base"
|
78
|
+
|
76
79
|
#widget proxy
|
77
80
|
match '/widgets/:widget_name/:widget_action/:uuid(/:id)' => "widget_proxy#index", :as => :widget
|
78
81
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateTailDesktopApplication
|
2
|
+
def self.up
|
3
|
+
app = DesktopApplication.create(
|
4
|
+
:description => 'Tail',
|
5
|
+
:icon => 'icon-document_pulse',
|
6
|
+
:javascript_class_name => 'Compass.ErpApp.Desktop.Applications.Tail',
|
7
|
+
:internal_identifier => 'tail',
|
8
|
+
:shortcut_id => 'tail-win'
|
9
|
+
)
|
10
|
+
pt1 = PreferenceType.iid('desktop_shortcut')
|
11
|
+
pt1.preferenced_records << app
|
12
|
+
pt1.save
|
13
|
+
|
14
|
+
pt2 = PreferenceType.iid('autoload_application')
|
15
|
+
pt2.preferenced_records << app
|
16
|
+
pt2.save
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.down
|
20
|
+
DesktopApplication.destroy_all(['internal_identifier = ?','tail'])
|
21
|
+
end
|
22
|
+
end
|
data/lib/erp_app/version.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.Tail",{
|
2
|
+
extend:"Ext.ux.desktop.Module",
|
3
|
+
id:'tail-win',
|
4
|
+
init : function(){
|
5
|
+
this.launcher = {
|
6
|
+
text: 'Tail',
|
7
|
+
iconCls:'icon-document_pulse',
|
8
|
+
handler: this.createWindow,
|
9
|
+
scope: this
|
10
|
+
}
|
11
|
+
},
|
12
|
+
|
13
|
+
createWindow : function(){
|
14
|
+
var desktop = this.app.getDesktop();
|
15
|
+
var win = desktop.getWindow('tail');
|
16
|
+
if(!win){
|
17
|
+
win = desktop.createWindow({
|
18
|
+
id: 'tail',
|
19
|
+
title:'Tail',
|
20
|
+
width:1000,
|
21
|
+
height:550,
|
22
|
+
iconCls: 'icon-document_pulse',
|
23
|
+
shim:false,
|
24
|
+
animCollapse:false,
|
25
|
+
constrainHeader:true,
|
26
|
+
layout: 'fit',
|
27
|
+
items:[
|
28
|
+
{
|
29
|
+
xtype:'tail-tailpanel'
|
30
|
+
}
|
31
|
+
]
|
32
|
+
});
|
33
|
+
}
|
34
|
+
win.show();
|
35
|
+
}
|
36
|
+
});
|
@@ -0,0 +1,145 @@
|
|
1
|
+
Ext.define('Compass.ErpApp.Desktop.Applications.Tail.TailPanel',{
|
2
|
+
extend: 'Ext.Panel',
|
3
|
+
alias: 'widget.tail-tailpanel',
|
4
|
+
tailing: false,
|
5
|
+
docked:'top',
|
6
|
+
cursor: 0,
|
7
|
+
tailTask: null,
|
8
|
+
autoScroll:true,
|
9
|
+
|
10
|
+
dockedItems:[
|
11
|
+
{
|
12
|
+
xtype:'toolbar',
|
13
|
+
items:[
|
14
|
+
{
|
15
|
+
text:'Start Tailing',
|
16
|
+
itemId: 'start',
|
17
|
+
handler:function(btn){
|
18
|
+
var startBtn = btn,
|
19
|
+
endBtn = btn.up('panel').down('#stop'),
|
20
|
+
panel = btn.up('panel');
|
21
|
+
|
22
|
+
Ext.createWidget('window', {
|
23
|
+
title:'Start Tailing',
|
24
|
+
buttonAlign:'center',
|
25
|
+
items:[
|
26
|
+
{
|
27
|
+
xtype:'form',
|
28
|
+
bodyPadding:'5px',
|
29
|
+
defaults:{
|
30
|
+
xtype:'numberfield'
|
31
|
+
},
|
32
|
+
items:[
|
33
|
+
{
|
34
|
+
fieldLabel:'Interval In Seconds',
|
35
|
+
value: '5',
|
36
|
+
name:'seconds'
|
37
|
+
}
|
38
|
+
]
|
39
|
+
}
|
40
|
+
],
|
41
|
+
buttons:[
|
42
|
+
{
|
43
|
+
text:'Start',
|
44
|
+
handler:function(btn){
|
45
|
+
var window = btn.up('window'),
|
46
|
+
values = btn.up('window').down('form').getValues();
|
47
|
+
|
48
|
+
panel.startTailing(values);
|
49
|
+
startBtn.disable();
|
50
|
+
endBtn.enable();
|
51
|
+
window.close();
|
52
|
+
}
|
53
|
+
},
|
54
|
+
{
|
55
|
+
text:'Cancel',
|
56
|
+
handler:function(btn){
|
57
|
+
btn.up('window').close();
|
58
|
+
}
|
59
|
+
}
|
60
|
+
]
|
61
|
+
}).show();
|
62
|
+
}
|
63
|
+
},
|
64
|
+
{
|
65
|
+
text: 'Stop Tailing',
|
66
|
+
itemId: 'stop',
|
67
|
+
disabled: true,
|
68
|
+
handler: function(btn){
|
69
|
+
var startBtn = btn.up('panel').down('#start'),
|
70
|
+
panel = btn.up('panel');
|
71
|
+
|
72
|
+
panel.stopTailing();
|
73
|
+
btn.disable();
|
74
|
+
startBtn.enable();
|
75
|
+
}
|
76
|
+
},
|
77
|
+
{
|
78
|
+
text: 'Clear',
|
79
|
+
itemId: 'clear',
|
80
|
+
handler: function(btn){
|
81
|
+
var panel = btn.up('panel');
|
82
|
+
|
83
|
+
panel.update('');
|
84
|
+
}
|
85
|
+
}
|
86
|
+
]
|
87
|
+
}
|
88
|
+
],
|
89
|
+
html: '',
|
90
|
+
bodyStyle: {
|
91
|
+
backgroundColor: 'black',
|
92
|
+
color: 'yellow'
|
93
|
+
},
|
94
|
+
|
95
|
+
startTailing: function(values){
|
96
|
+
this.tailing = true;
|
97
|
+
this.cursor = 0;
|
98
|
+
if(this.tailTask){
|
99
|
+
this.tailTask.start();
|
100
|
+
}
|
101
|
+
else{
|
102
|
+
var runner = new Ext.util.TaskRunner();
|
103
|
+
this.tailTask = runner.newTask({
|
104
|
+
run: this.tail,
|
105
|
+
interval: (parseInt(values['seconds']) * 1000),
|
106
|
+
scope: this
|
107
|
+
});
|
108
|
+
this.tailTask.start();
|
109
|
+
}
|
110
|
+
},
|
111
|
+
|
112
|
+
stopTailing: function(){
|
113
|
+
this.tailTask.stop();
|
114
|
+
this.tailing = false;
|
115
|
+
},
|
116
|
+
|
117
|
+
tail: function(){
|
118
|
+
var me = this;
|
119
|
+
|
120
|
+
if(me.tailing){
|
121
|
+
Ext.Ajax.request({
|
122
|
+
url: '/erp_app/desktop/tail/get_tail',
|
123
|
+
params:{
|
124
|
+
cursor: me.cursor
|
125
|
+
},
|
126
|
+
success:function(response){
|
127
|
+
responseObj = Ext.JSON.decode(response.responseText);
|
128
|
+
if(responseObj.success){
|
129
|
+
me.cursor = responseObj.cursor;
|
130
|
+
me.update(me.body.dom.innerHTML + responseObj.tail);
|
131
|
+
|
132
|
+
var d = me.body.dom;
|
133
|
+
d.scrollTop = d.scrollHeight - d.offsetHeight;
|
134
|
+
}
|
135
|
+
},
|
136
|
+
failure:function(){
|
137
|
+
|
138
|
+
}
|
139
|
+
});
|
140
|
+
}
|
141
|
+
else{
|
142
|
+
this.tailTask.stop();
|
143
|
+
}
|
144
|
+
}
|
145
|
+
});
|
@@ -1,22 +1,22 @@
|
|
1
1
|
Ext.ns('Compass.ErpApp.Mobile.JobTracker.Templates');
|
2
2
|
Compass.ErpApp.Mobile.JobTracker.Templates.jobDetails = new Ext.XTemplate(
|
3
3
|
'<div class="profile">',
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
4
|
+
'<p>',
|
5
|
+
'<span class="label">Job Name</span>',
|
6
|
+
'<span class="value">{job_name}</span>',
|
7
|
+
'</p>',
|
8
|
+
'<p>',
|
9
|
+
'<span class="label">Last Run At</span>',
|
10
|
+
'<span class="value">{last_run_at:date("m/d/Y g:i:s")}</span>',
|
11
|
+
'</p>',
|
12
|
+
'<p>',
|
13
|
+
'<span class="label">Next Run At</span>',
|
14
|
+
'<span class="value">{next_run_at:date("m/d/Y g:i:s")}</span>',
|
15
|
+
'</p>',
|
16
|
+
'<p>',
|
17
|
+
'<span class="label">Runtime</span>',
|
18
|
+
'<span class="value">{run_time}</span>',
|
19
|
+
'</p>',
|
20
20
|
'</div>',
|
21
21
|
'<br/>',
|
22
22
|
'<div id="resetPasswdBtnHolder"></div>');
|
@@ -31,6 +31,11 @@
|
|
31
31
|
padding : 5px;
|
32
32
|
}
|
33
33
|
|
34
|
+
.icon-document_pulse {
|
35
|
+
background-image: url(/images/icons/document_pulse/document_pulse_16x16.png) !important;
|
36
|
+
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/icons/document_pulse/document_pulse_16x16.png', sizingMethod='crop');
|
37
|
+
}
|
38
|
+
|
34
39
|
.icon-tasks {
|
35
40
|
background-image: url(/images/icons/calendar/calendar_16x16.png) !important;
|
36
41
|
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/icons/calendar/calendar_16x16.png', sizingMethod='crop');
|
@@ -0,0 +1,12 @@
|
|
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
|
@@ -0,0 +1,19 @@
|
|
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
|
data/spec/dummy/db/data_migrations/20130422163130_setup_compass_ae_instance.erp_base_erp_svcs.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# This migration comes from erp_base_erp_svcs (originally 20110913145838)
|
2
|
+
class SetupCompassAeInstance
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
c = CompassAeInstance.new
|
6
|
+
c.description = 'Base CompassAE Instance'
|
7
|
+
c.internal_identifier = 'base'
|
8
|
+
c.version = '3.1'
|
9
|
+
c.save
|
10
|
+
|
11
|
+
rt = RoleType.new
|
12
|
+
rt.description = 'CompassAE Instance Owner'
|
13
|
+
rt.internal_identifier = 'compass_ae_instance_owner'
|
14
|
+
rt.save
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.down
|
18
|
+
#remove data here
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This migration comes from erp_base_erp_svcs (originally 20130211555555)
|
2
|
+
class UpgradeCompassAeInstancesData < ActiveRecord::Migration
|
3
|
+
def self.up
|
4
|
+
if CompassAeInstance.find_by_internal_identifier('base').nil?
|
5
|
+
c = CompassAeInstance.order('id ASC').first
|
6
|
+
c.description = 'Base CompassAE Instance'
|
7
|
+
c.internal_identifier = 'base'
|
8
|
+
c.schema = 'public'
|
9
|
+
c.save
|
10
|
+
end
|
11
|
+
|
12
|
+
if RoleType.find_by_internal_identifier('compass_ae_instance_owner').nil?
|
13
|
+
rt = RoleType.new
|
14
|
+
rt.description = 'CompassAE Instance Owner'
|
15
|
+
rt.internal_identifier = 'compass_ae_instance_owner'
|
16
|
+
rt.save
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/dummy/db/data_migrations/20130422163133_create_capability_scope_types.erp_tech_svcs.rb
ADDED
@@ -0,0 +1,15 @@
|
|
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
|
@@ -0,0 +1,16 @@
|
|
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
|
@@ -0,0 +1,22 @@
|
|
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
|
@@ -0,0 +1,20 @@
|
|
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
|
@@ -0,0 +1,24 @@
|
|
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
|