openproject-global_roles 1.0.0
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.
- checksums.yaml +15 -0
- data/CHANGELOG.md +22 -0
- data/README.md +89 -0
- data/app/assets/javascripts/global_roles/global_roles.js +91 -0
- data/app/assets/javascripts/global_roles/principal_roles.js +51 -0
- data/app/assets/stylesheets/global_roles/global_roles.css +18 -0
- data/app/controllers/principal_roles_controller.rb +139 -0
- data/app/models/global_role.rb +46 -0
- data/app/models/principal_role.rb +29 -0
- data/app/views/principal_roles/_errors.html.erb +13 -0
- data/app/views/principal_roles/_show_table_row.html.erb +28 -0
- data/app/views/principal_roles/index.html.erb +47 -0
- data/app/views/roles/_form.html.erb +52 -0
- data/app/views/roles/_global_attributes.html.erb +12 -0
- data/app/views/roles/_global_form.html.erb +12 -0
- data/app/views/roles/_member_attributes.html.erb +17 -0
- data/app/views/roles/_member_form.html.erb +39 -0
- data/app/views/roles/_permissions.html.erb +27 -0
- data/app/views/roles/edit.html.erb +20 -0
- data/app/views/roles/index.html.erb +57 -0
- data/app/views/roles/new.html.erb +18 -0
- data/app/views/shared/_global_roles_header.html.erb +16 -0
- data/app/views/users/_available_global_role.html.erb +14 -0
- data/app/views/users/_available_global_roles.html.erb +32 -0
- data/app/views/users/_global_roles.html.erb +33 -0
- data/config/locales/de.yml +11 -0
- data/config/locales/en.yml +11 -0
- data/config/routes.rb +14 -0
- data/db/migrate/001_sti_for_roles.rb +34 -0
- data/doc/COPYRIGHT.rdoc +16 -0
- data/doc/GPL.txt +674 -0
- data/lib/open_project/global_roles.rb +16 -0
- data/lib/open_project/global_roles/engine.rb +89 -0
- data/lib/open_project/global_roles/patches.rb +13 -0
- data/lib/open_project/global_roles/patches/access_control_patch.rb +41 -0
- data/lib/open_project/global_roles/patches/permission_patch.rb +49 -0
- data/lib/open_project/global_roles/patches/principal_patch.rb +24 -0
- data/lib/open_project/global_roles/patches/role_patch.rb +47 -0
- data/lib/open_project/global_roles/patches/roles_controller_patch.rb +62 -0
- data/lib/open_project/global_roles/patches/roles_helper_patch.rb +27 -0
- data/lib/open_project/global_roles/patches/user_patch.rb +24 -0
- data/lib/open_project/global_roles/patches/users_controller_patch.rb +34 -0
- data/lib/open_project/global_roles/patches/users_helper_patch.rb +39 -0
- data/lib/open_project/global_roles/principal_allowance_evaluator/global.rb +24 -0
- data/lib/open_project/global_roles/version.rb +16 -0
- data/lib/openproject-global_roles.rb +12 -0
- data/spec/controllers/principal_roles_controller_spec.rb +163 -0
- data/spec/controllers/roles_controller_spec.rb +315 -0
- data/spec/controllers/users_controller_spec.rb +57 -0
- data/spec/factories/global_role_factory.rb +16 -0
- data/spec/factories/principal_role_factory.rb +17 -0
- data/spec/lib/access_control_spec.rb +56 -0
- data/spec/lib/global_roles/principal_allowance_evaluator/global_spec.rb +84 -0
- data/spec/lib/loader_spec.rb +40 -0
- data/spec/lib/permission_spec.rb +41 -0
- data/spec/models/global_role_spec.rb +175 -0
- data/spec/models/principal_role_spec.rb +48 -0
- data/spec/models/principal_spec.rb +38 -0
- data/spec/models/role_spec.rb +43 -0
- data/spec/models/user_spec.rb +20 -0
- data/spec/plugin_spec_helper.rb +152 -0
- data/spec/spec_helper.rb +15 -0
- metadata +152 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
#-- copyright
|
2
|
+
# OpenProject is a project management system.
|
3
|
+
#
|
4
|
+
# Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
#
|
6
|
+
# This program is free software; you can redistribute it and/or
|
7
|
+
# modify it under the terms of the GNU General Public License version 3.
|
8
|
+
#
|
9
|
+
# See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
#++
|
11
|
+
|
12
|
+
class PrincipalRole < ActiveRecord::Base
|
13
|
+
belongs_to :principal
|
14
|
+
belongs_to :role
|
15
|
+
validate :validate_assignable
|
16
|
+
|
17
|
+
attr_accessible :principal,
|
18
|
+
:role
|
19
|
+
|
20
|
+
def validate_assignable
|
21
|
+
add_error_can_not_be_assigned unless self.role.assignable_to?(self.principal)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def add_error_can_not_be_assigned
|
27
|
+
self.errors[:base] << l(:error_can_not_be_assigned)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<%= error_messages_for 'principal_role' %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<tr id="principal_role-<%= principal_role.id %>">
|
14
|
+
<td class="role assigned_global_role_<%= principal_role.role_id%>">
|
15
|
+
<%=h principal_role.role %>
|
16
|
+
</td>
|
17
|
+
<%= call_hook(:principal_roles_table_row, :user => @user, :principal_role => principal_role )%>
|
18
|
+
<td class="buttons">
|
19
|
+
<% buttons = {:edit => false} %>
|
20
|
+
<%= call_hook(:principal_roles_edit_button_needed, :buttons => buttons) %>
|
21
|
+
<% if buttons[:edit]%>
|
22
|
+
<%= link_to_function l(:button_edit), "return false;", :class => 'icon icon-edit' %>
|
23
|
+
<%end%>
|
24
|
+
<%= link_to_remote(l(:button_delete), { :url => principal_role_url(principal_role.id),
|
25
|
+
:method => :delete },
|
26
|
+
:class => 'icon icon-del') %>
|
27
|
+
</td>
|
28
|
+
</tr>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<div class="contextual">
|
14
|
+
<%= link_to l(:label_role_new), :action => 'new', :class => 'icon icon-add' %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<h2><%=Role.model_name.human(:count => 2)%></h2>
|
18
|
+
|
19
|
+
<table class="list">
|
20
|
+
<thead><tr>
|
21
|
+
<th><%= Role.model_name.human %></th>
|
22
|
+
<th><%=l(:button_sort)%></th>
|
23
|
+
<th></th>
|
24
|
+
</tr></thead>
|
25
|
+
<tbody>
|
26
|
+
<% for role in @roles %>
|
27
|
+
<tr class="<%= cycle("odd", "even") %>">
|
28
|
+
<td><%= content_tag('span', link_to(role.name, :action => 'edit', :id => role)) %></td>
|
29
|
+
<td align="center" style="width:15%;">
|
30
|
+
|
31
|
+
<%= reorder_links('role', {:action => 'edit', :id => role}) %>
|
32
|
+
|
33
|
+
</td>
|
34
|
+
<td class="buttons">
|
35
|
+
<%= link_to(l(:button_delete), principal_role_path(role),
|
36
|
+
:method => :delete,
|
37
|
+
:confirm => l(:text_are_you_sure),
|
38
|
+
:class => 'icon icon-del')%>
|
39
|
+
</td>
|
40
|
+
</tr>
|
41
|
+
<% end %>
|
42
|
+
</tbody>
|
43
|
+
</table>
|
44
|
+
|
45
|
+
<p><%= link_to l(:label_permissions_report), :action => 'report' %></p>
|
46
|
+
|
47
|
+
<%= html_title(Role.model_name.human(:count => 2)) -%>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<%= render :partial => 'shared/global_roles_header' %>
|
14
|
+
|
15
|
+
<% roles ||= nil %>
|
16
|
+
|
17
|
+
<%= error_messages_for :role %>
|
18
|
+
|
19
|
+
<div class="box">
|
20
|
+
<p><%= f.text_field :name, :required => true %></p>
|
21
|
+
<p>
|
22
|
+
<% if role.new_record? %>
|
23
|
+
<label for='global_role'><%= l(:label_global_role)%></label><%= check_box_tag("global_role", "1", role.is_a?(GlobalRole))%>
|
24
|
+
<%else%>
|
25
|
+
<span class="label">
|
26
|
+
<%= l(:label_role_type) + " " + l(:label_not_changeable)%></span>
|
27
|
+
<%= (role.is_a?(GlobalRole) ? l(:label_global_role) : l(:label_member_role))%>
|
28
|
+
<%end%>
|
29
|
+
</p>
|
30
|
+
<% if role.new_record? || role.is_a?(GlobalRole) %>
|
31
|
+
<div id="global_attributes" style="display:none">
|
32
|
+
<%= render :partial => "global_attributes", :locals => { :f => f, :role => role, :roles => (roles.present? ? roles.select {|r| r.is_a?(GlobalRole)} : nil) }%>
|
33
|
+
</div>
|
34
|
+
<%end%>
|
35
|
+
<%if role.new_record? || !role.is_a?(GlobalRole)%>
|
36
|
+
<div id="member_attributes">
|
37
|
+
<%= render :partial => "member_attributes", :locals => { :f => f, :role => role, :roles => (roles.present? ? roles.select {|r| !r.is_a?(GlobalRole)} : nil)}%>
|
38
|
+
</div>
|
39
|
+
<%end%>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<h3><%= l(:label_permissions) %></h3>
|
43
|
+
<% if role.new_record? || role.is_a?(GlobalRole)%>
|
44
|
+
<div id="global_permissions" style=<%= role.new_record? ? "display:none" : ""%> >
|
45
|
+
<%= render :partial => "permissions", :locals => {:permissions => global_permissions, :role => role }%>
|
46
|
+
</div>
|
47
|
+
<%end%>
|
48
|
+
<%if role.new_record? || !role.is_a?(GlobalRole)%>
|
49
|
+
<div id="member_permissions">
|
50
|
+
<%= render :partial => "permissions", :locals => {:permissions => member_permissions, :role => role }%>
|
51
|
+
</div>
|
52
|
+
<%end%>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<p><%= f.check_box :assignable %></p>
|
14
|
+
<% if role.new_record? && roles.any? %>
|
15
|
+
<p><label><%= l(:label_copy_workflow_from) %></label>
|
16
|
+
<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles.select{|r| !r.is_a?(GlobalRole)}, :id, :name)) %></p>
|
17
|
+
<% end %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<% unless role.builtin? %>
|
14
|
+
<div class="box">
|
15
|
+
<p><%= f.text_field :name, :required => true %></p>
|
16
|
+
<p><%= f.check_box :assignable %></p>
|
17
|
+
<% if role.new_record? && roles.any? %>
|
18
|
+
<p><label><%= l(:label_copy_workflow_from) %></label>
|
19
|
+
<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles, :id, :name)) %></p>
|
20
|
+
<% end %>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<h3><%= l(:label_permissions) %></h3>
|
25
|
+
<div class="box" id="permissions">
|
26
|
+
<% perms_by_module = @permissions.group_by {|p| p.project_module.to_s} %>
|
27
|
+
<% perms_by_module.keys.sort.each do |mod| %>
|
28
|
+
<fieldset><legend><%= mod.blank? ? Project.model_name.human : l_or_humanize(mod, :prefix => 'project_module_') %></legend>
|
29
|
+
<% perms_by_module[mod].each do |permission| %>
|
30
|
+
<label class="floating">
|
31
|
+
<%= check_box_tag 'role[permissions][]', permission.name, (@role.permissions.include? permission.name) %>
|
32
|
+
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
33
|
+
</label>
|
34
|
+
<% end %>
|
35
|
+
</fieldset>
|
36
|
+
<% end %>
|
37
|
+
<br /><%= check_all_links 'permissions' %>
|
38
|
+
<%= hidden_field_tag 'role[permissions][]', '' %>
|
39
|
+
</div>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<%= tag "div", { :class =>"box", :id => permissions_id(permissions) }, false %>
|
14
|
+
<% perms_by_module = permissions.group_by {|p| p.project_module.to_s} %>
|
15
|
+
<% perms_by_module.keys.sort.each do |mod| %>
|
16
|
+
<fieldset><legend><%= mod.blank? ? Project.model_name.human : l_or_humanize(mod, :prefix => 'project_module_') %></legend>
|
17
|
+
<% perms_by_module[mod].each do |permission| %>
|
18
|
+
<label class="floating">
|
19
|
+
<%= check_box_tag 'role[permissions][]', permission.name, (role.permissions && role.permissions.include?(permission.name)) %>
|
20
|
+
<%= l_or_humanize(permission.name, :prefix => 'permission_') %>
|
21
|
+
</label>
|
22
|
+
<% end %>
|
23
|
+
</fieldset>
|
24
|
+
<% end %>
|
25
|
+
<br /><%= check_all_links permissions_id(permissions) %>
|
26
|
+
<%= hidden_field_tag 'role[permissions][]', '' %>
|
27
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<h2><%= link_to Role.model_name.human(:count => 2), roles_path %> » <%=h @role.name %></h2>
|
14
|
+
|
15
|
+
<%= labelled_tabular_form_for @role, :url => { :action => 'update' }, :html => {:id => 'role_form'}, :as => :role do |f| %>
|
16
|
+
<%= hidden_field_tag :id, @role.id %>
|
17
|
+
<%= render :partial => 'form', :locals => { :f => f , :role => @role, :member_permissions => (@role.is_a?(GlobalRole) ? nil : @permissions),
|
18
|
+
:global_permissions => (@role.is_a?(GlobalRole) ? @permissions : nil)} %>
|
19
|
+
<%= submit_tag l(:button_save) %>
|
20
|
+
<% end %>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<div class="contextual">
|
14
|
+
<%= link_to l(:label_role_new), {:action => 'new'}, :class => 'icon icon-add' %>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<h2><%= Role.model_name.human(:count => 2) %></h2>
|
18
|
+
|
19
|
+
<table class="list">
|
20
|
+
<thead>
|
21
|
+
<tr>
|
22
|
+
<th><%= Role.model_name.human %></th>
|
23
|
+
<th><%=l(:label_global)%></th>
|
24
|
+
<th><%=l(:button_sort)%></th>
|
25
|
+
<th></th>
|
26
|
+
</tr>
|
27
|
+
</thead>
|
28
|
+
<tbody>
|
29
|
+
<% for role in @roles %>
|
30
|
+
<tr class="<%= cycle("odd", "even") %>">
|
31
|
+
<td>
|
32
|
+
<%= content_tag(role.builtin? ? 'em' : 'span', link_to(role.name, :action => 'edit', :id => role)) %>
|
33
|
+
</td>
|
34
|
+
<td align="center" style="width:15%;">
|
35
|
+
<%= image_tag('check.png', :alt => l(:general_text_Yes)) if role.is_a?(GlobalRole) %>
|
36
|
+
</td>
|
37
|
+
<td align="center" style="width:15%;">
|
38
|
+
<% unless role.builtin? %>
|
39
|
+
<%= reorder_links('role', {:action => 'update', :id => role}, :method => :put) %>
|
40
|
+
<% end %>
|
41
|
+
</td>
|
42
|
+
<td class="buttons">
|
43
|
+
<%= link_to(l(:button_delete), role_path(role),
|
44
|
+
:method => :delete,
|
45
|
+
:confirm => l(:text_are_you_sure),
|
46
|
+
:class => 'icon icon-del') unless role.builtin? %>
|
47
|
+
</td>
|
48
|
+
</tr>
|
49
|
+
<% end %>
|
50
|
+
</tbody>
|
51
|
+
</table>
|
52
|
+
|
53
|
+
<%= pagination_links_full @roles %>
|
54
|
+
|
55
|
+
<p><%= link_to l(:label_permissions_report), :action => 'report' %></p>
|
56
|
+
|
57
|
+
<% html_title(Role.model_name.human(:count => 2)) -%>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<h2><%= link_to Role.model_name.human(:count => 2), :controller => 'roles', :action => 'index' %> » <%=l(:label_role_new)%></h2>
|
14
|
+
|
15
|
+
<%= labelled_tabular_form_for @role, :url => { :action => 'create' }, :html => {:id => 'role_form'}, :as => :role do |f| %>
|
16
|
+
<%= render :partial => 'form', :locals => { :f => f, :role => @role, :member_role => @member_role, :global_role => @global_role, :roles => @roles, :member_permissions => @member_permissions, :global_permissions => @global_permissions} %>
|
17
|
+
<%= submit_tag l(:button_create) %>
|
18
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<% content_for :header_tags do %>
|
14
|
+
<%= stylesheet_link_tag 'global_roles/global_roles.css' %>
|
15
|
+
<%= javascript_include_tag 'global_roles/global_roles.js' %>
|
16
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<div class="principal_role_option" id= "principal_role_option_<%=h (role.id)%>">
|
14
|
+
<%= check_box_tag 'principal_role[role_ids][]', role.id, false, :id => "principal_role_role_ids_#{role.id}", :disabled => !role.assignable_to?(@user) %><%= label_tag "principal_role_role_ids_#{role.id}", h(role) %></div>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<%#-- copyright
|
2
|
+
OpenProject is a project management system.
|
3
|
+
|
4
|
+
Copyright (C) 2010-2013 the OpenProject Team
|
5
|
+
|
6
|
+
This program is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU General Public License version 3.
|
8
|
+
|
9
|
+
See doc/COPYRIGHT.rdoc for more details.
|
10
|
+
|
11
|
+
++#%>
|
12
|
+
|
13
|
+
<% def available_additional_global_roles available_roles, user
|
14
|
+
available_roles - user.global_roles
|
15
|
+
end%>
|
16
|
+
|
17
|
+
<div class="splitcontentright" id="available_principal_roles">
|
18
|
+
<fieldset><legend><%= Role.model_name.human(:count => 2) %></legend>
|
19
|
+
<span id="additional_principal_roles">
|
20
|
+
<%= remote_form_for(:principal_roles, :url => principal_roles_url, :method => :post) do %>
|
21
|
+
<%= hidden_field_tag 'principal_role[principal_id]', user.id %>
|
22
|
+
<% available_additional_global_roles(global_roles, user).each do |role| %>
|
23
|
+
<%= render :partial => 'users/available_global_role', :locals => {:role => role} %>
|
24
|
+
<% end %>
|
25
|
+
<p><%= submit_tag l(:button_add) %></p>
|
26
|
+
<% end %>
|
27
|
+
</span>
|
28
|
+
<span id="no_additional_principal_roles" style="display:none">
|
29
|
+
<p id="no_data" class="nodata"><%= l(:label_no_assignable_role) %></p>
|
30
|
+
<span>
|
31
|
+
</fieldset>
|
32
|
+
</div>
|