erp_app 3.0.13 → 3.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/erp_app/desktop/audit_log_viewer/base_controller.rb +1 -1
- data/app/controllers/erp_app/desktop/file_manager/base_controller.rb +5 -5
- data/app/controllers/erp_app/desktop/scaffold/role_controller.rb +1 -1
- data/app/controllers/erp_app/desktop/security_management/base_controller.rb +47 -0
- data/app/controllers/erp_app/desktop/security_management/capabilities_controller.rb +129 -0
- data/app/controllers/erp_app/desktop/security_management/groups_controller.rb +201 -0
- data/app/controllers/erp_app/desktop/security_management/roles_controller.rb +188 -0
- data/app/controllers/erp_app/desktop/security_management/users_controller.rb +145 -0
- data/app/controllers/erp_app/desktop/user_management/base_controller.rb +2 -2
- data/app/controllers/erp_app/desktop/user_management/role_management_controller.rb +6 -6
- data/app/controllers/erp_app/public_controller.rb +3 -14
- data/app/models/application.rb +1 -10
- data/app/models/configuration_item_type.rb +1 -1
- data/app/models/configuration_option.rb +1 -1
- data/app/models/widget.rb +2 -11
- data/config/routes.rb +6 -3
- data/db/data_migrations/20110728201729_erp_app_setup.rb +2 -48
- data/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.rb +4 -1
- data/db/data_migrations/20111108183739_add_default_capabilities.rb +11 -18
- data/db/data_migrations/20111108183740_add_new_contact_widgets.rb +4 -13
- data/db/data_migrations/20120229160222_add_userinfo_widget.rb +6 -8
- data/db/data_migrations/20120418164215_create_configuration_management_desktop_application.rb +4 -0
- data/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.rb +15 -0
- data/db/data_migrations/20121218175028_create_security_management_desktop_application.rb +28 -0
- data/lib/erp_app/engine.rb +5 -5
- data/lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb +4 -3
- data/lib/erp_app/extensions/railties/action_view/helpers/tag_helper.rb +8 -2
- data/lib/erp_app/version.rb +1 -1
- data/lib/erp_app/widgets/base.rb +4 -0
- data/lib/erp_app/widgets/loader.rb +40 -34
- data/public/images/icons/add/Thumbs.db +0 -0
- data/public/images/icons/calendar/Thumbs.db +0 -0
- data/public/images/icons/copy/Thumbs.db +0 -0
- data/public/images/icons/cut/Thumbs.db +0 -0
- data/public/images/icons/delete/Thumbs.db +0 -0
- data/public/images/icons/edit/Thumbs.db +0 -0
- data/public/images/icons/folder/Thumbs.db +0 -0
- data/public/images/icons/gear/Thumbs.db +0 -0
- data/public/images/icons/globe/Thumbs.db +0 -0
- data/public/images/icons/grid/Thumbs.db +0 -0
- data/public/images/icons/help/Thumbs.db +0 -0
- data/public/images/icons/information/Thumbs.db +0 -0
- data/public/images/icons/key/Thumbs.db +0 -0
- data/public/images/icons/log_out/Thumbs.db +0 -0
- data/public/images/icons/mail/Thumbs.db +0 -0
- data/public/images/icons/new/Thumbs.db +0 -0
- data/public/images/icons/next/Thumbs.db +0 -0
- data/public/images/icons/open/Thumbs.db +0 -0
- data/public/images/icons/paste/Thumbs.db +0 -0
- data/public/images/icons/picture/Thumbs.db +0 -0
- data/public/images/icons/presentation/Thumbs.db +0 -0
- data/public/images/icons/preview/Thumbs.db +0 -0
- data/public/images/icons/previous/Thumbs.db +0 -0
- data/public/images/icons/print/Thumbs.db +0 -0
- data/public/images/icons/properties/Thumbs.db +0 -0
- data/public/images/icons/redo/Thumbs.db +0 -0
- data/public/images/icons/refresh/Thumbs.db +0 -0
- data/public/images/icons/remove/Thumbs.db +0 -0
- data/public/images/icons/rename/Thumbs.db +0 -0
- data/public/images/icons/save/Thumbs.db +0 -0
- data/public/images/icons/search/Thumbs.db +0 -0
- data/public/images/icons/send/Thumbs.db +0 -0
- data/public/images/icons/settings/Thumbs.db +0 -0
- data/public/images/icons/synchronize/Thumbs.db +0 -0
- data/public/images/icons/undo/Thumbs.db +0 -0
- data/public/images/icons/upload/Thumbs.db +0 -0
- data/public/images/icons/user/Thumbs.db +0 -0
- data/public/images/icons/zoom_in/Thumbs.db +0 -0
- data/public/images/icons/zoom_out/Thumbs.db +0 -0
- data/public/javascripts/erp_app/authentication/compass_user.js +22 -19
- data/public/javascripts/erp_app/authentication/widget_manager.js +107 -107
- data/public/javascripts/erp_app/ckeditor/plugins/inlineeditsave/plugin.js +23 -23
- data/public/javascripts/erp_app/ckeditor/plugins/jwplayer/jwplayer/Thumbs.db +0 -0
- data/public/javascripts/erp_app/desktop/applications/file_manager/module.js +2 -2
- data/public/javascripts/erp_app/desktop/applications/security_management/capabilities_panel.js +82 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/capabilities_widget.js +254 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/groups_effective_security.js +98 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/groups_panel.js +295 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/groups_widget.js +254 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/module.js +71 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/roles_panel.js +298 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/roles_widget.js +254 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/users_effective_security.js +125 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/users_panel.js +95 -0
- data/public/javascripts/erp_app/desktop/applications/security_management/users_widget.js +254 -0
- data/public/javascripts/erp_app/desktop/applications/user_management/module.js +38 -58
- data/public/javascripts/erp_app/organizer/applications/crm/base.js +698 -698
- data/public/javascripts/erp_app/organizer/applications/crm/contact_mechanism_grid.js +1 -4
- data/public/javascripts/erp_app/shared/compass_codemirror.js +1 -1
- data/public/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js +1 -1
- data/public/javascripts/erp_app/shared/dynamic_forms/dynamic_form_fields.js +99 -0
- data/public/javascripts/erp_app/shared/file_manager_tree.js +1 -2
- data/public/javascripts/erp_app/shared/notes_grid.js +4 -13
- data/public/stylesheets/erp_app/shared/compass-ext-all.css +5 -0
- metadata +70 -20
- data/config/environment.rb +0 -0
- data/spec/dummy/db/schema.rb +0 -806
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/adam.log +0 -1
- data/spec/dummy/log/spec.log +0 -92886
@@ -0,0 +1,145 @@
|
|
1
|
+
module ErpApp
|
2
|
+
module Desktop
|
3
|
+
module SecurityManagement
|
4
|
+
class UsersController < ErpApp::Desktop::SecurityManagement::BaseController
|
5
|
+
|
6
|
+
def available_setup
|
7
|
+
begin
|
8
|
+
columns = []
|
9
|
+
columns << DynamicGridColumn.build_column({ :fieldLabel => "Party Description", :name => 'party_description', :xtype => 'textfield', :width => 200 })
|
10
|
+
columns << DynamicGridColumn.build_column({ :fieldLabel => "Username", :name => 'username', :xtype => 'textfield', :width => 95 })
|
11
|
+
columns << DynamicGridColumn.build_column({ :fieldLabel => "Email", :name => 'email', :xtype => 'textfield', :width => 100 })
|
12
|
+
|
13
|
+
definition = []
|
14
|
+
definition << DynamicFormField.textfield({ :fieldLabel => "Party Description", :name => 'party_description' })
|
15
|
+
definition << DynamicFormField.textfield({ :fieldLabel => "Username", :name => 'username' })
|
16
|
+
definition << DynamicFormField.textfield({ :fieldLabel => "Email", :name => 'email' })
|
17
|
+
definition << DynamicFormField.hidden({ :fieldLabel => "ID", :name => 'id' })
|
18
|
+
|
19
|
+
render :inline => "{
|
20
|
+
\"success\": true,
|
21
|
+
\"columns\": [#{columns.join(',')}],
|
22
|
+
\"fields\": #{definition.to_json}
|
23
|
+
}"
|
24
|
+
rescue Exception => e
|
25
|
+
Rails.logger.error e.message
|
26
|
+
Rails.logger.error e.backtrace.join("\n")
|
27
|
+
render :inline => {
|
28
|
+
:success => false,
|
29
|
+
:message => e.message
|
30
|
+
}.to_json
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def selected_setup
|
35
|
+
available_setup
|
36
|
+
end
|
37
|
+
|
38
|
+
def available
|
39
|
+
assign_to = params[:assign_to]
|
40
|
+
assign_to_id = params[:id]
|
41
|
+
sort = (params[:sort] || 'username').downcase
|
42
|
+
dir = (params[:dir] || 'asc').downcase
|
43
|
+
query_filter = params[:query_filter].strip rescue nil
|
44
|
+
|
45
|
+
ar = assign_to_id.blank? ? User : assign_to.constantize.find(assign_to_id).users_not
|
46
|
+
ar = params[:query_filter].blank? ? ar : ar.where("UPPER(username) LIKE UPPER('%#{query_filter}%') OR UPPER(email) LIKE UPPER('%#{query_filter}%') ")
|
47
|
+
available = ar.paginate(:page => page, :per_page => per_page, :order => "#{sort} #{dir}")
|
48
|
+
|
49
|
+
render :json => {:total => ar.count, :data => available.map{|x| {:username => x.username, :email => x.email, :party_description => x.party.description, :id => x.id}}}
|
50
|
+
end
|
51
|
+
|
52
|
+
def selected
|
53
|
+
assign_to = params[:assign_to]
|
54
|
+
assign_to_id = params[:id]
|
55
|
+
sort = (params[:sort] || 'username').downcase
|
56
|
+
dir = (params[:dir] || 'asc').downcase
|
57
|
+
query_filter = params[:query_filter].strip rescue nil
|
58
|
+
|
59
|
+
ar = assign_to_id.blank? ? User : assign_to.constantize.find(assign_to_id).users
|
60
|
+
ar = (params[:query_filter].blank? ? ar : ar.where("UPPER(username) LIKE UPPER('%#{query_filter}%') OR UPPER(email) LIKE UPPER('%#{query_filter}%') "))
|
61
|
+
selected = ar.paginate(:page => page, :per_page => per_page, :order => "#{sort} #{dir}")
|
62
|
+
|
63
|
+
render :json => {:total => ar.count, :data => selected.map{|x| {:username => x.username, :email => x.email, :party_description => x.party.description, :id => x.id}}}
|
64
|
+
end
|
65
|
+
|
66
|
+
def add
|
67
|
+
begin
|
68
|
+
assign_to = params[:assign_to]
|
69
|
+
assign_to_id = params[:id]
|
70
|
+
selected = JSON.parse(params[:selection])
|
71
|
+
|
72
|
+
a = assign_to.constantize.find(assign_to_id)
|
73
|
+
selected.each do |x|
|
74
|
+
u = User.find(x)
|
75
|
+
case assign_to
|
76
|
+
when 'Group'
|
77
|
+
a.add_user(u)
|
78
|
+
when 'SecurityRole'
|
79
|
+
u.add_role(a)
|
80
|
+
when 'Capability'
|
81
|
+
u.add_capability(a)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
render :json => {:success => true, :message => 'Group(s) Added'}
|
86
|
+
rescue Exception => e
|
87
|
+
Rails.logger.error e.message
|
88
|
+
Rails.logger.error e.backtrace.join("\n")
|
89
|
+
render :inline => {
|
90
|
+
:success => false,
|
91
|
+
:message => e.message
|
92
|
+
}.to_json
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def remove
|
97
|
+
begin
|
98
|
+
assign_to = params[:assign_to]
|
99
|
+
assign_to_id = params[:id]
|
100
|
+
selected = JSON.parse(params[:selection])
|
101
|
+
|
102
|
+
a = assign_to.constantize.find(assign_to_id)
|
103
|
+
selected.each do |x|
|
104
|
+
u = User.find(x)
|
105
|
+
case assign_to
|
106
|
+
when 'Group'
|
107
|
+
a.remove_user(u)
|
108
|
+
when 'SecurityRole'
|
109
|
+
u.remove_role(a)
|
110
|
+
when 'Capability'
|
111
|
+
u.remove_capability(a)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
render :json => {:success => true, :message => 'Group(s) Removed'}
|
116
|
+
rescue Exception => e
|
117
|
+
Rails.logger.error e.message
|
118
|
+
Rails.logger.error e.backtrace.join("\n")
|
119
|
+
render :inline => {
|
120
|
+
:success => false,
|
121
|
+
:message => e.message
|
122
|
+
}.to_json
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def effective_security
|
127
|
+
begin
|
128
|
+
assign_to_id = params[:id]
|
129
|
+
u = User.find(assign_to_id)
|
130
|
+
|
131
|
+
render :json => {:success => true, :roles => u.all_roles, :capabilities => u.class_capabilities_to_hash }
|
132
|
+
rescue Exception => e
|
133
|
+
Rails.logger.error e.message
|
134
|
+
Rails.logger.error e.backtrace.join("\n")
|
135
|
+
render :inline => {
|
136
|
+
:success => false,
|
137
|
+
:message => e.message
|
138
|
+
}.to_json
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -28,7 +28,7 @@ module ErpApp
|
|
28
28
|
response = {}
|
29
29
|
application = DesktopApplication.find_by_internal_identifier('user_management')
|
30
30
|
begin
|
31
|
-
current_user.with_capability(
|
31
|
+
current_user.with_capability(:create, 'User') do
|
32
32
|
|
33
33
|
user = User.new(
|
34
34
|
:email => params[:email],
|
@@ -76,7 +76,7 @@ module ErpApp
|
|
76
76
|
|
77
77
|
def delete
|
78
78
|
application = DesktopApplication.find_by_internal_identifier('user_management')
|
79
|
-
if current_user.has_capability?(
|
79
|
+
if current_user.has_capability?('create', 'User')
|
80
80
|
unless @user.party.nil?
|
81
81
|
@user.party.destroy
|
82
82
|
else
|
@@ -5,7 +5,7 @@ module ErpApp
|
|
5
5
|
|
6
6
|
def available_roles
|
7
7
|
user_id = params[:user_id]
|
8
|
-
roles =
|
8
|
+
roles = SecurityRole.order('description ASC').all
|
9
9
|
|
10
10
|
unless user_id.empty?
|
11
11
|
current_role_ids = User.find(user_id).roles.collect{|r| r.id}
|
@@ -20,7 +20,7 @@ module ErpApp
|
|
20
20
|
roles = []
|
21
21
|
|
22
22
|
unless user_id.empty?
|
23
|
-
roles = User.find(user_id).roles
|
23
|
+
roles = User.find(user_id).roles.order('description ASC')
|
24
24
|
end
|
25
25
|
|
26
26
|
render :json => roles.map{|role| {:text => role.description, :iconCls => 'icon-user', :leaf => true, :role_id => role.id}}
|
@@ -31,10 +31,10 @@ module ErpApp
|
|
31
31
|
user_id = params[:user_id]
|
32
32
|
|
33
33
|
user = User.find(user_id)
|
34
|
-
roles =
|
35
|
-
user.remove_all_roles
|
36
|
-
user.add_roles(roles)
|
37
|
-
user.save
|
34
|
+
roles = SecurityRole.where("id in (#{role_ids.join(',')})").all
|
35
|
+
user.party.remove_all_roles
|
36
|
+
user.party.add_roles(roles)
|
37
|
+
user.party.save
|
38
38
|
|
39
39
|
render :json => {:success => true, :message => 'Roles Saved'}
|
40
40
|
end
|
@@ -2,17 +2,6 @@ module ErpApp
|
|
2
2
|
class PublicController < ActionController::Base
|
3
3
|
before_filter :set_file_support
|
4
4
|
|
5
|
-
# DEPRECATED, use erp_app/public#download
|
6
|
-
# def download_file
|
7
|
-
# path = params[:path]
|
8
|
-
# file_klass = FileAsset.type_by_extension(File.extname(path))
|
9
|
-
# if file_klass == Image
|
10
|
-
# send_file path, :type => "image/#{File.extname(path)}"
|
11
|
-
# else
|
12
|
-
# send_file path, :type => file_klass.content_type
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
|
16
5
|
# TODO:
|
17
6
|
# reorder menuitems
|
18
7
|
# drag and drop image into ckeditor uses bad (but somehow not broken, i.e. ../../images/) url (filesystem on firefox, chrome OK)
|
@@ -28,10 +17,10 @@ module ErpApp
|
|
28
17
|
file = file.first
|
29
18
|
|
30
19
|
unless file.nil?
|
31
|
-
if file.
|
20
|
+
if file.is_secured?
|
32
21
|
begin
|
33
22
|
unless current_user == false
|
34
|
-
current_user.with_capability(
|
23
|
+
current_user.with_capability(:download, file) do
|
35
24
|
serve_file(file, disposition)
|
36
25
|
end
|
37
26
|
else
|
@@ -58,7 +47,7 @@ module ErpApp
|
|
58
47
|
if ErpTechSvcs::Config.file_storage == :s3
|
59
48
|
path = File.join(file.directory,file.name).sub(%r{^/},'')
|
60
49
|
options = { :response_content_disposition => disposition }
|
61
|
-
options[:expires] = ErpTechSvcs::Config.s3_url_expires_in_seconds if file.
|
50
|
+
options[:expires] = ErpTechSvcs::Config.s3_url_expires_in_seconds if file.is_secured?
|
62
51
|
redirect_to @file_support.bucket.objects[path].url_for(:read, options).to_s
|
63
52
|
else
|
64
53
|
# to use X-Sendfile or X-Accel-Redirect, set config.action_dispatch.x_sendfile_header in environment config file
|
data/app/models/application.rb
CHANGED
@@ -1,20 +1,11 @@
|
|
1
1
|
class Application < ActiveRecord::Base
|
2
|
-
has_capabilities
|
3
2
|
has_user_preferences
|
4
3
|
|
5
4
|
has_and_belongs_to_many :app_containers
|
6
5
|
has_and_belongs_to_many :widgets
|
7
6
|
|
8
7
|
validates_uniqueness_of :javascript_class_name
|
9
|
-
validates_uniqueness_of :internal_identifier, :scope => :type
|
10
|
-
|
11
|
-
def to_access_hash
|
12
|
-
{
|
13
|
-
:iid => self.internal_identifier,
|
14
|
-
:capabilities => self.capabilites_to_hash,
|
15
|
-
:widgets => widgets.collect{|widget| widget.to_access_hash}
|
16
|
-
}
|
17
|
-
end
|
8
|
+
validates_uniqueness_of :internal_identifier, :scope => :type, :case_sensitive => false
|
18
9
|
|
19
10
|
def locate_resources(resource_type)
|
20
11
|
resource_loader = ErpApp::ApplicationResourceLoader::DesktopOrganizerLoader.new(self)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class ConfigurationOption < ActiveRecord::Base
|
2
|
-
validates :internal_identifier, :uniqueness => {:scope => :id}
|
2
|
+
validates :internal_identifier, :uniqueness => {:scope => :id, :case_sensitive => false}
|
3
3
|
|
4
4
|
has_and_belongs_to_many :configuration_item_types
|
5
5
|
has_and_belongs_to_many :configuration_items
|
data/app/models/widget.rb
CHANGED
@@ -1,18 +1,9 @@
|
|
1
1
|
class Widget < ActiveRecord::Base
|
2
|
-
has_roles
|
3
|
-
has_capabilities
|
4
2
|
|
5
3
|
has_and_belongs_to_many :applications
|
6
4
|
has_many :user_preferences, :as => :preferenced_record
|
7
5
|
|
8
|
-
validates_uniqueness_of :xtype
|
9
|
-
validates_uniqueness_of :internal_identifier
|
6
|
+
validates_uniqueness_of :xtype, :case_sensitive => false
|
7
|
+
validates_uniqueness_of :internal_identifier, :case_sensitive => false
|
10
8
|
|
11
|
-
def to_access_hash
|
12
|
-
{
|
13
|
-
:xtype => self.xtype,
|
14
|
-
:roles => self.roles.collect{|role| role.internal_identifier},
|
15
|
-
:capabilities => self.capabilites_to_hash
|
16
|
-
}
|
17
|
-
end
|
18
9
|
end
|
data/config/routes.rb
CHANGED
@@ -50,9 +50,12 @@ ErpApp::Engine.routes.draw do
|
|
50
50
|
match '/desktop/user_management/role_management/:action' => "desktop/user_management/role_management"
|
51
51
|
match '/desktop/user_management/application_management/:action' => "desktop/user_management/application_management"
|
52
52
|
|
53
|
-
#
|
54
|
-
match '/desktop/
|
55
|
-
match '/desktop/
|
53
|
+
#security_management
|
54
|
+
match '/desktop/security_management/groups(/:action(/:assign_to(/:id)))' => "desktop/security_management/groups"
|
55
|
+
match '/desktop/security_management/users(/:action(/:assign_to(/:id)))' => "desktop/security_management/users"
|
56
|
+
match '/desktop/security_management/roles(/:action(/:assign_to(/:id)))' => "desktop/security_management/roles"
|
57
|
+
match '/desktop/security_management/capabilities(/:action(/:assign_to(/:id)))' => "desktop/security_management/capabilities"
|
58
|
+
match '/desktop/security_management/(/:action)' => "desktop/security_management/base"
|
56
59
|
|
57
60
|
#control_panel
|
58
61
|
match '/desktop/control_panel/application_management/:action(/:id)' => "desktop/control_panel/application_management"
|
@@ -30,8 +30,8 @@ class ErpAppSetup
|
|
30
30
|
#######################################
|
31
31
|
#roles
|
32
32
|
#######################################
|
33
|
-
|
34
|
-
|
33
|
+
SecurityRole.create(:description => 'Admin', :internal_identifier => 'admin')
|
34
|
+
SecurityRole.create(:description => 'Employee', :internal_identifier => 'employee')
|
35
35
|
|
36
36
|
#######################################
|
37
37
|
#desktop setup
|
@@ -97,9 +97,6 @@ class ErpAppSetup
|
|
97
97
|
:xtype => 'shared_notesgrid',
|
98
98
|
:internal_identifier => 'shared_notes_grid'
|
99
99
|
)
|
100
|
-
|
101
|
-
notes_grid.add_role('admin')
|
102
|
-
notes_grid.add_role('employee')
|
103
100
|
notes_grid.save
|
104
101
|
|
105
102
|
#######################################
|
@@ -111,8 +108,6 @@ class ErpAppSetup
|
|
111
108
|
:xtype => 'controlpanel_userapplicationmgtpanel',
|
112
109
|
:internal_identifier => 'application_management'
|
113
110
|
)
|
114
|
-
|
115
|
-
app_mgr.add_role('admin')
|
116
111
|
app_mgr.save
|
117
112
|
|
118
113
|
role_mgr = ::Widget.create(
|
@@ -121,8 +116,6 @@ class ErpAppSetup
|
|
121
116
|
:xtype => 'usermanagement_rolemanagementpanel',
|
122
117
|
:internal_identifier => 'role_management'
|
123
118
|
)
|
124
|
-
|
125
|
-
role_mgr.add_role('admin')
|
126
119
|
role_mgr.save
|
127
120
|
|
128
121
|
personal_info = ::Widget.create(
|
@@ -131,9 +124,6 @@ class ErpAppSetup
|
|
131
124
|
:xtype => 'usermanagement_personalinfopanel',
|
132
125
|
:internal_identifier => 'user_personal_info'
|
133
126
|
)
|
134
|
-
|
135
|
-
personal_info.add_role('admin')
|
136
|
-
personal_info.add_role('employee')
|
137
127
|
personal_info.save
|
138
128
|
|
139
129
|
#create application and assign widgets
|
@@ -154,34 +144,6 @@ class ErpAppSetup
|
|
154
144
|
user_mgr_app.widgets << notes_grid
|
155
145
|
user_mgr_app.save
|
156
146
|
|
157
|
-
#######################################
|
158
|
-
#system management app
|
159
|
-
#######################################
|
160
|
-
app_role_management = ::Widget.create(
|
161
|
-
:description => 'Application Role Management',
|
162
|
-
:icon => 'icon-document',
|
163
|
-
:xtype => 'systemmanagement_applicationrolemanagment',
|
164
|
-
:internal_identifier => 'application_role_management'
|
165
|
-
)
|
166
|
-
|
167
|
-
app_role_management.add_role('admin')
|
168
|
-
app_role_management.save
|
169
|
-
|
170
|
-
system_management_app = DesktopApplication.create(
|
171
|
-
:description => 'System Management',
|
172
|
-
:icon => 'icon-monitor',
|
173
|
-
:javascript_class_name => 'Compass.ErpApp.Desktop.Applications.SystemManagement',
|
174
|
-
:internal_identifier => 'system_management',
|
175
|
-
:shortcut_id => 'system_management-win'
|
176
|
-
)
|
177
|
-
|
178
|
-
system_management_app.preference_types << desktop_shortcut_pt
|
179
|
-
system_management_app.preference_types << auto_load_app_pt
|
180
|
-
|
181
|
-
system_management_app.widgets << app_role_management
|
182
|
-
system_management_app.save
|
183
|
-
|
184
|
-
|
185
147
|
#######################################
|
186
148
|
#scaffold app
|
187
149
|
#######################################
|
@@ -207,9 +169,6 @@ class ErpAppSetup
|
|
207
169
|
:xtype => 'contactmechanismgrid',
|
208
170
|
:internal_identifier => 'party_contact_management'
|
209
171
|
)
|
210
|
-
|
211
|
-
party_contact_mgm_widget.add_role('admin')
|
212
|
-
party_contact_mgm_widget.add_role('employee')
|
213
172
|
party_contact_mgm_widget.save
|
214
173
|
|
215
174
|
party_mgm_widget = ::Widget.create(
|
@@ -218,9 +177,6 @@ class ErpAppSetup
|
|
218
177
|
:xtype => 'partygrid',
|
219
178
|
:internal_identifier => 'party_management_widget'
|
220
179
|
)
|
221
|
-
|
222
|
-
party_mgm_widget.add_role('admin')
|
223
|
-
party_mgm_widget.add_role('employee')
|
224
180
|
party_mgm_widget.save
|
225
181
|
|
226
182
|
#create application
|
@@ -275,14 +231,12 @@ class ErpAppSetup
|
|
275
231
|
truenorth_user.save
|
276
232
|
|
277
233
|
admin_user.desktop.applications << user_mgr_app
|
278
|
-
admin_user.desktop.applications << system_management_app
|
279
234
|
admin_user.desktop.applications << scaffold_app
|
280
235
|
admin_user.desktop.save
|
281
236
|
admin_user.organizer.applications << crm_app
|
282
237
|
admin_user.organizer.save
|
283
238
|
|
284
239
|
truenorth_user.desktop.applications << user_mgr_app
|
285
|
-
truenorth_user.desktop.applications << system_management_app
|
286
240
|
truenorth_user.desktop.applications << scaffold_app
|
287
241
|
truenorth_user.desktop.save
|
288
242
|
truenorth_user.organizer.applications << crm_app
|
@@ -11,7 +11,10 @@ class CreateDesktopAppAuditLogViewer
|
|
11
11
|
app.preference_types << PreferenceType.iid('desktop_shortcut')
|
12
12
|
app.preference_types << PreferenceType.iid('autoload_application')
|
13
13
|
app.save
|
14
|
-
|
14
|
+
|
15
|
+
admin_user = User.find_by_username('admin')
|
16
|
+
admin_user.desktop.applications << app
|
17
|
+
admin_user.desktop.save
|
15
18
|
end
|
16
19
|
|
17
20
|
def self.down
|
@@ -1,29 +1,22 @@
|
|
1
1
|
class AddDefaultCapabilities
|
2
2
|
|
3
3
|
def self.up
|
4
|
-
|
5
|
-
|
6
|
-
CapabilityType.create(:internal_identifier => 'create', :description => 'Create')
|
7
|
-
CapabilityType.create(:internal_identifier => 'view', :description => 'View')
|
4
|
+
admin = SecurityRole.find_by_internal_identifier('admin')
|
5
|
+
employee = SecurityRole.find_by_internal_identifier('employee')
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
user_management_application.add_capability('delete', 'User', 'admin')
|
7
|
+
admin.add_capability('create', 'User')
|
8
|
+
admin.add_capability('delete', 'User')
|
12
9
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
admin.add_capability('create', 'Note')
|
11
|
+
employee.add_capability('create', 'Note')
|
12
|
+
|
13
|
+
admin.add_capability('view', 'Note')
|
14
|
+
employee.add_capability('view', 'Note')
|
15
|
+
|
16
|
+
admin.add_capability('delete', 'Note')
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.down
|
20
|
-
CapabilityType.destroy_all("internal_identifier in (#{%w(edit,delete,create,view).map{|iid| "'#{iid}'"}.join(',')}")
|
21
|
-
|
22
|
-
user_management_application = DesktopApplication.find_by_internal_identifier('user_management')
|
23
|
-
user_management_application.remove_all_capabilities
|
24
|
-
|
25
|
-
notes_widget = Widget.find_by_internal_identifier('shared_notes_grid')
|
26
|
-
notes_widget.remove_all_capabilities
|
27
20
|
end
|
28
21
|
|
29
22
|
end
|