1965 |
10 Feb 06 |
nicklas |
1 |
<%-- $Id$ |
1965 |
10 Feb 06 |
nicklas |
2 |
------------------------------------------------------------------ |
5425 |
23 Sep 10 |
nicklas |
Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2007 Nicklas Nordborg |
1965 |
10 Feb 06 |
nicklas |
5 |
|
2304 |
22 May 06 |
jari |
6 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
7 |
Available at http://base.thep.lu.se/ |
1965 |
10 Feb 06 |
nicklas |
8 |
|
1965 |
10 Feb 06 |
nicklas |
9 |
BASE is free software; you can redistribute it and/or |
1965 |
10 Feb 06 |
nicklas |
10 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
11 |
as published by the Free Software Foundation; either version 3 |
1965 |
10 Feb 06 |
nicklas |
12 |
of the License, or (at your option) any later version. |
1965 |
10 Feb 06 |
nicklas |
13 |
|
1965 |
10 Feb 06 |
nicklas |
14 |
BASE is distributed in the hope that it will be useful, |
1965 |
10 Feb 06 |
nicklas |
15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1965 |
10 Feb 06 |
nicklas |
16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1965 |
10 Feb 06 |
nicklas |
17 |
GNU General Public License for more details. |
1965 |
10 Feb 06 |
nicklas |
18 |
|
1965 |
10 Feb 06 |
nicklas |
19 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
20 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1965 |
10 Feb 06 |
nicklas |
21 |
------------------------------------------------------------------ |
1965 |
10 Feb 06 |
nicklas |
22 |
|
1965 |
10 Feb 06 |
nicklas |
23 |
@author Nicklas |
1965 |
10 Feb 06 |
nicklas |
24 |
@version 2.0 |
1965 |
10 Feb 06 |
nicklas |
25 |
--%> |
5426 |
24 Sep 10 |
nicklas |
26 |
<%@ page pageEncoding="UTF-8" session="false" |
1965 |
10 Feb 06 |
nicklas |
27 |
import="net.sf.basedb.core.SessionControl" |
1965 |
10 Feb 06 |
nicklas |
28 |
import="net.sf.basedb.core.DbControl" |
1965 |
10 Feb 06 |
nicklas |
29 |
import="net.sf.basedb.core.SystemItems" |
1965 |
10 Feb 06 |
nicklas |
30 |
import="net.sf.basedb.core.Item" |
1965 |
10 Feb 06 |
nicklas |
31 |
import="net.sf.basedb.core.ItemContext" |
1965 |
10 Feb 06 |
nicklas |
32 |
import="net.sf.basedb.core.Permission" |
1965 |
10 Feb 06 |
nicklas |
33 |
import="net.sf.basedb.core.Role" |
1965 |
10 Feb 06 |
nicklas |
34 |
import="net.sf.basedb.core.User" |
1965 |
10 Feb 06 |
nicklas |
35 |
import="net.sf.basedb.core.RoleKey" |
1965 |
10 Feb 06 |
nicklas |
36 |
import="net.sf.basedb.core.PermissionDeniedException" |
1965 |
10 Feb 06 |
nicklas |
37 |
import="net.sf.basedb.core.PluginDefinition" |
1965 |
10 Feb 06 |
nicklas |
38 |
import="net.sf.basedb.core.ItemQuery" |
1965 |
10 Feb 06 |
nicklas |
39 |
import="net.sf.basedb.core.ItemResultList" |
1965 |
10 Feb 06 |
nicklas |
40 |
import="net.sf.basedb.core.Include" |
1965 |
10 Feb 06 |
nicklas |
41 |
import="net.sf.basedb.core.query.Orders" |
1965 |
10 Feb 06 |
nicklas |
42 |
import="net.sf.basedb.core.query.Hql" |
1965 |
10 Feb 06 |
nicklas |
43 |
import="net.sf.basedb.core.plugin.GuiContext" |
1965 |
10 Feb 06 |
nicklas |
44 |
import="net.sf.basedb.core.plugin.Plugin" |
1965 |
10 Feb 06 |
nicklas |
45 |
import="net.sf.basedb.clients.web.Base" |
1965 |
10 Feb 06 |
nicklas |
46 |
import="net.sf.basedb.clients.web.PermissionUtil" |
1965 |
10 Feb 06 |
nicklas |
47 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
48 |
import="net.sf.basedb.util.Values" |
4698 |
10 Dec 08 |
nicklas |
49 |
import="net.sf.basedb.util.formatter.Formatter" |
4698 |
10 Dec 08 |
nicklas |
50 |
import="net.sf.basedb.clients.web.formatter.FormatterFactory" |
4886 |
03 Apr 09 |
nicklas |
51 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
4886 |
03 Apr 09 |
nicklas |
52 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
4886 |
03 Apr 09 |
nicklas |
53 |
import="net.sf.basedb.clients.web.extensions.renderer.PrefixSuffixRenderer" |
7604 |
25 Feb 19 |
nicklas |
54 |
import="net.sf.basedb.clients.web.extensions.toolbar.ButtonAction" |
4886 |
03 Apr 09 |
nicklas |
55 |
import="net.sf.basedb.clients.web.extensions.toolbar.ToolbarUtil" |
4886 |
03 Apr 09 |
nicklas |
56 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
4698 |
10 Dec 08 |
nicklas |
57 |
import="java.util.Date" |
1965 |
10 Feb 06 |
nicklas |
58 |
import="java.util.Map" |
1965 |
10 Feb 06 |
nicklas |
59 |
import="java.util.Set" |
1965 |
10 Feb 06 |
nicklas |
60 |
import="java.util.List" |
1965 |
10 Feb 06 |
nicklas |
61 |
%> |
1965 |
10 Feb 06 |
nicklas |
62 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1965 |
10 Feb 06 |
nicklas |
63 |
<%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
1965 |
10 Feb 06 |
nicklas |
64 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
1965 |
10 Feb 06 |
nicklas |
65 |
<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %> |
4886 |
03 Apr 09 |
nicklas |
66 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
1965 |
10 Feb 06 |
nicklas |
67 |
<%! |
1965 |
10 Feb 06 |
nicklas |
68 |
private static final Item itemType = Item.ROLE; |
1965 |
10 Feb 06 |
nicklas |
69 |
private static final GuiContext guiContext = new GuiContext(itemType, GuiContext.Type.ITEM); |
1965 |
10 Feb 06 |
nicklas |
70 |
|
1965 |
10 Feb 06 |
nicklas |
71 |
private static final String getShortPermissions(Item itemType, Set<Permission> permissions) |
1965 |
10 Feb 06 |
nicklas |
72 |
{ |
1965 |
10 Feb 06 |
nicklas |
73 |
Set<Permission> defined = itemType.getDefinedPermissions(); |
1965 |
10 Feb 06 |
nicklas |
74 |
StringBuilder sb = new StringBuilder(); |
1965 |
10 Feb 06 |
nicklas |
75 |
if (defined.contains(Permission.CREATE)) sb.append(permissions.contains(Permission.CREATE) ? "C" : "-"); |
1965 |
10 Feb 06 |
nicklas |
76 |
if (defined.contains(Permission.READ)) sb.append(permissions.contains(Permission.READ) ? "R" : "-"); |
1965 |
10 Feb 06 |
nicklas |
77 |
if (defined.contains(Permission.USE)) sb.append(permissions.contains(Permission.USE) ? "U" : "-"); |
7216 |
19 Oct 16 |
nicklas |
78 |
if (defined.contains(Permission.RESTRICTED_WRITE)) sb.append(permissions.contains(Permission.RESTRICTED_WRITE) ? "A" : "-"); |
1965 |
10 Feb 06 |
nicklas |
79 |
if (defined.contains(Permission.WRITE)) sb.append(permissions.contains(Permission.WRITE) ? "W" : "-"); |
1965 |
10 Feb 06 |
nicklas |
80 |
if (defined.contains(Permission.DELETE)) sb.append(permissions.contains(Permission.DELETE) ? "D" : "-"); |
1965 |
10 Feb 06 |
nicklas |
81 |
if (defined.contains(Permission.SET_OWNER)) sb.append(permissions.contains(Permission.SET_OWNER) ? "O" : "-"); |
1965 |
10 Feb 06 |
nicklas |
82 |
if (defined.contains(Permission.SET_PERMISSION)) sb.append(permissions.contains(Permission.SET_PERMISSION) ? "P" : "-"); |
1965 |
10 Feb 06 |
nicklas |
83 |
return sb.toString(); |
1965 |
10 Feb 06 |
nicklas |
84 |
} |
1965 |
10 Feb 06 |
nicklas |
85 |
%> |
1965 |
10 Feb 06 |
nicklas |
86 |
<% |
1965 |
10 Feb 06 |
nicklas |
87 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1965 |
10 Feb 06 |
nicklas |
88 |
final String ID = sc.getId(); |
1965 |
10 Feb 06 |
nicklas |
89 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1965 |
10 Feb 06 |
nicklas |
90 |
final int itemId = cc.getId(); |
1965 |
10 Feb 06 |
nicklas |
91 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
92 |
final DbControl dc = sc.newDbControl(":View "+itemType); |
1965 |
10 Feb 06 |
nicklas |
93 |
try |
1965 |
10 Feb 06 |
nicklas |
94 |
{ |
4698 |
10 Dec 08 |
nicklas |
95 |
Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc); |
1965 |
10 Feb 06 |
nicklas |
96 |
Map<Plugin.MainType, Integer> pluginCount = PluginDefinition.countPlugins(dc, guiContext); |
1965 |
10 Feb 06 |
nicklas |
97 |
|
1965 |
10 Feb 06 |
nicklas |
98 |
String title = null; |
1965 |
10 Feb 06 |
nicklas |
99 |
Role role = Role.getById(dc, itemId); |
1965 |
10 Feb 06 |
nicklas |
100 |
|
1965 |
10 Feb 06 |
nicklas |
101 |
RoleKey system = RoleKey.getById(dc, SystemItems.getRoleKeyId(Item.SYSTEM)); |
1965 |
10 Feb 06 |
nicklas |
102 |
final boolean hasShareToEveryone = system.getPermissions(role).contains(Permission.SHARE_TO_EVERYONE); |
1965 |
10 Feb 06 |
nicklas |
103 |
final boolean hasActAsAnotherUser = system.getPermissions(role).contains(Permission.ACT_AS_ANOTHER_USER); |
4311 |
23 May 08 |
nicklas |
104 |
final boolean hasSelectJobagent = system.getPermissions(role).contains(Permission.SELECT_JOBAGENT); |
1965 |
10 Feb 06 |
nicklas |
105 |
|
1965 |
10 Feb 06 |
nicklas |
106 |
final boolean writePermission = role.hasPermission(Permission.WRITE); |
1965 |
10 Feb 06 |
nicklas |
107 |
final boolean deletePermission = role.hasPermission(Permission.DELETE); |
4003 |
26 Nov 07 |
nicklas |
108 |
final boolean isRemoved = role.isRemoved(); |
4003 |
26 Nov 07 |
nicklas |
109 |
final boolean isUsed = isRemoved && role.isUsed(); |
4003 |
26 Nov 07 |
nicklas |
110 |
final boolean deletePermanentlyPermission = deletePermission && !isUsed; |
4886 |
03 Apr 09 |
nicklas |
111 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, guiContext, role); |
7604 |
25 Feb 19 |
nicklas |
112 |
ExtensionsInvoker<ButtonAction> invoker = ToolbarUtil.useExtensions(jspContext); |
1965 |
10 Feb 06 |
nicklas |
113 |
%> |
6224 |
15 Jan 13 |
nicklas |
114 |
<base:page title="<%=title%>" id="view-page"> |
6322 |
11 Sep 13 |
nicklas |
115 |
<base:head scripts="table.js,tabcontrol-2.js,~roles.js" styles="toolbar.css,table.css,headertabcontrol.css,path.css"> |
4886 |
03 Apr 09 |
nicklas |
116 |
<ext:scripts context="<%=jspContext%>" /> |
4886 |
03 Apr 09 |
nicklas |
117 |
<ext:stylesheets context="<%=jspContext%>" /> |
1965 |
10 Feb 06 |
nicklas |
118 |
</base:head> |
1965 |
10 Feb 06 |
nicklas |
119 |
<base:body> |
5941 |
01 Feb 12 |
nicklas |
120 |
<p:path><p:pathelement |
5941 |
01 Feb 12 |
nicklas |
121 |
title="Roles" href="<%="index.jsp?ID="+ID%>" |
5941 |
01 Feb 12 |
nicklas |
122 |
/><p:pathelement title="<%=HTML.encodeTags(role.getName())%>" |
5941 |
01 Feb 12 |
nicklas |
123 |
/></p:path> |
6224 |
15 Jan 13 |
nicklas |
124 |
|
6224 |
15 Jan 13 |
nicklas |
125 |
<div id="page-data" data-item-id="<%=itemId%>"></div> |
1965 |
10 Feb 06 |
nicklas |
126 |
|
5941 |
01 Feb 12 |
nicklas |
127 |
<t:tabcontrol |
5941 |
01 Feb 12 |
nicklas |
128 |
id="main" |
5941 |
01 Feb 12 |
nicklas |
129 |
subclass="content mastertabcontrol" |
5941 |
01 Feb 12 |
nicklas |
130 |
active="properties"> |
1965 |
10 Feb 06 |
nicklas |
131 |
<t:tab id="properties" title="Properties"> |
5941 |
01 Feb 12 |
nicklas |
132 |
<div> |
5941 |
01 Feb 12 |
nicklas |
133 |
<table class="fullform bottomborder"> |
5941 |
01 Feb 12 |
nicklas |
134 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
135 |
<th class="itemstatus"> |
4003 |
26 Nov 07 |
nicklas |
136 |
<base:icon |
6224 |
15 Jan 13 |
nicklas |
137 |
id="btnDeletePermanently" |
5946 |
03 Feb 12 |
nicklas |
138 |
image="deleted.png" |
5941 |
01 Feb 12 |
nicklas |
139 |
tooltip="This item has been flagged for deletion. Click to delete it now." |
5941 |
01 Feb 12 |
nicklas |
140 |
enabled="<%=deletePermanentlyPermission %>" |
5941 |
01 Feb 12 |
nicklas |
141 |
visible="<%=isRemoved%>" |
5941 |
01 Feb 12 |
nicklas |
142 |
/> |
6224 |
15 Jan 13 |
nicklas |
143 |
<base:icon |
6224 |
15 Jan 13 |
nicklas |
144 |
id="btnUsingItems" |
6224 |
15 Jan 13 |
nicklas |
145 |
image="used.png" |
5941 |
01 Feb 12 |
nicklas |
146 |
tooltip="This item is used by other items and can't be permanently deleted. Show the items that are using this one" |
5941 |
01 Feb 12 |
nicklas |
147 |
visible="<%=isRemoved && isUsed%>" /> |
5941 |
01 Feb 12 |
nicklas |
148 |
</th> |
5941 |
01 Feb 12 |
nicklas |
149 |
<td style="padding: 0px;"> |
6605 |
18 Nov 14 |
nicklas |
150 |
<tbl:toolbar subclass="bottomborder bg-filled-50"> |
5941 |
01 Feb 12 |
nicklas |
151 |
<tbl:button |
6224 |
15 Jan 13 |
nicklas |
152 |
id="btnEdit" |
5942 |
01 Feb 12 |
nicklas |
153 |
disabled="<%=!writePermission%>" |
5945 |
02 Feb 12 |
nicklas |
154 |
image="edit.png" |
5941 |
01 Feb 12 |
nicklas |
155 |
title="Edit…" |
5941 |
01 Feb 12 |
nicklas |
156 |
tooltip="<%=writePermission ? "Edit this role" : "You do not have permission to edit this role"%>" |
5941 |
01 Feb 12 |
nicklas |
157 |
/> |
5941 |
01 Feb 12 |
nicklas |
158 |
<tbl:button |
6224 |
15 Jan 13 |
nicklas |
159 |
id="btnDelete" |
5942 |
01 Feb 12 |
nicklas |
160 |
disabled="<%=!deletePermission%>" |
5946 |
03 Feb 12 |
nicklas |
161 |
image="delete.png" |
5941 |
01 Feb 12 |
nicklas |
162 |
title="Delete" |
5941 |
01 Feb 12 |
nicklas |
163 |
visible="<%=!role.isRemoved()%>" |
5941 |
01 Feb 12 |
nicklas |
164 |
tooltip="<%=deletePermission ? "Delete this role" : "You do not have permission to delete this role"%>" |
5941 |
01 Feb 12 |
nicklas |
165 |
/> |
5941 |
01 Feb 12 |
nicklas |
166 |
<tbl:button |
6224 |
15 Jan 13 |
nicklas |
167 |
id="btnRestore" |
5942 |
01 Feb 12 |
nicklas |
168 |
disabled="<%=!writePermission%>" |
5946 |
03 Feb 12 |
nicklas |
169 |
image="restore.png" |
5941 |
01 Feb 12 |
nicklas |
170 |
title="Restore" |
5941 |
01 Feb 12 |
nicklas |
171 |
visible="<%=role.isRemoved()%>" |
5941 |
01 Feb 12 |
nicklas |
172 |
tooltip="<%=writePermission ? "Restore this role" : "You do not have permission to restore this role"%>" |
5941 |
01 Feb 12 |
nicklas |
173 |
/> |
5941 |
01 Feb 12 |
nicklas |
174 |
<tbl:button |
6224 |
15 Jan 13 |
nicklas |
175 |
id="btnImport" |
5946 |
03 Feb 12 |
nicklas |
176 |
image="import.png" |
6224 |
15 Jan 13 |
nicklas |
177 |
data-plugin-type="IMPORT" |
5941 |
01 Feb 12 |
nicklas |
178 |
title="Import…" |
5941 |
01 Feb 12 |
nicklas |
179 |
tooltip="Import data" |
5941 |
01 Feb 12 |
nicklas |
180 |
visible="<%=pluginCount.containsKey(Plugin.MainType.IMPORT)%>" |
5941 |
01 Feb 12 |
nicklas |
181 |
/> |
5941 |
01 Feb 12 |
nicklas |
182 |
<tbl:button |
6224 |
15 Jan 13 |
nicklas |
183 |
id="btnExport" |
6224 |
15 Jan 13 |
nicklas |
184 |
image="export.png" |
6224 |
15 Jan 13 |
nicklas |
185 |
data-plugin-type="EXPORT" |
5941 |
01 Feb 12 |
nicklas |
186 |
title="Export…" |
5941 |
01 Feb 12 |
nicklas |
187 |
tooltip="Export data" |
5941 |
01 Feb 12 |
nicklas |
188 |
visible="<%=pluginCount.containsKey(Plugin.MainType.EXPORT)%>" |
5941 |
01 Feb 12 |
nicklas |
189 |
/> |
5941 |
01 Feb 12 |
nicklas |
190 |
<tbl:button |
6224 |
15 Jan 13 |
nicklas |
191 |
id="btnRunPlugin" |
6224 |
15 Jan 13 |
nicklas |
192 |
image="runplugin.png" |
6224 |
15 Jan 13 |
nicklas |
193 |
data-plugin-type="OTHER" |
5941 |
01 Feb 12 |
nicklas |
194 |
title="Run plugin…" |
5941 |
01 Feb 12 |
nicklas |
195 |
tooltip="Run a plugin" |
5941 |
01 Feb 12 |
nicklas |
196 |
visible="<%=pluginCount.containsKey(Plugin.MainType.OTHER)%>" |
5941 |
01 Feb 12 |
nicklas |
197 |
/> |
5941 |
01 Feb 12 |
nicklas |
198 |
<ext:render extensions="<%=invoker%>" context="<%=jspContext%>" |
7604 |
25 Feb 19 |
nicklas |
199 |
wrapper="<%=new PrefixSuffixRenderer<ButtonAction>(jspContext, "<td>", "</td>") %>"/> |
5941 |
01 Feb 12 |
nicklas |
200 |
<tbl:button |
5941 |
01 Feb 12 |
nicklas |
201 |
image="help.png" |
6224 |
15 Jan 13 |
nicklas |
202 |
subclass="auto-init" |
6224 |
15 Jan 13 |
nicklas |
203 |
data-auto-init="help" |
6224 |
15 Jan 13 |
nicklas |
204 |
data-help-id="role.view.properties" |
5941 |
01 Feb 12 |
nicklas |
205 |
title="Help…" |
5941 |
01 Feb 12 |
nicklas |
206 |
tooltip="Get help about this page" |
5941 |
01 Feb 12 |
nicklas |
207 |
/> |
5941 |
01 Feb 12 |
nicklas |
208 |
</tbl:toolbar> |
5941 |
01 Feb 12 |
nicklas |
209 |
</td> |
5941 |
01 Feb 12 |
nicklas |
210 |
</tr> |
1965 |
10 Feb 06 |
nicklas |
211 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
212 |
<th>Name</th> |
1965 |
10 Feb 06 |
nicklas |
213 |
<td><%=HTML.encodeTags(role.getName())%></td> |
1965 |
10 Feb 06 |
nicklas |
214 |
</tr> |
1965 |
10 Feb 06 |
nicklas |
215 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
216 |
<th>Registered</th> |
4698 |
10 Dec 08 |
nicklas |
217 |
<td><%=dateFormatter.format(role.getEntryDate())%></td> |
4698 |
10 Dec 08 |
nicklas |
218 |
</tr> |
4698 |
10 Dec 08 |
nicklas |
219 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
220 |
<th>System ID</th> |
1965 |
10 Feb 06 |
nicklas |
221 |
<td><%=HTML.encodeTags(role.getSystemId())%></td> |
1965 |
10 Feb 06 |
nicklas |
222 |
</tr> |
1965 |
10 Feb 06 |
nicklas |
223 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
224 |
<th>Is default</th> |
3467 |
08 Jun 07 |
nicklas |
225 |
<td><%=role.isDefault() ? "yes" : "no"%></td> |
3467 |
08 Jun 07 |
nicklas |
226 |
</tr> |
3467 |
08 Jun 07 |
nicklas |
227 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
228 |
<th>Permissions</th> |
5941 |
01 Feb 12 |
nicklas |
229 |
<td><%=PermissionUtil.getFullPermissionNames(role)%></td> |
5941 |
01 Feb 12 |
nicklas |
230 |
</tr> |
5941 |
01 Feb 12 |
nicklas |
231 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
232 |
<th>Description</th> |
1965 |
10 Feb 06 |
nicklas |
233 |
<td><%=HTML.niceFormat(role.getDescription())%></td> |
1965 |
10 Feb 06 |
nicklas |
234 |
</tr> |
1965 |
10 Feb 06 |
nicklas |
235 |
</table> |
5941 |
01 Feb 12 |
nicklas |
236 |
</div> |
1965 |
10 Feb 06 |
nicklas |
237 |
|
5042 |
11 Aug 09 |
martin |
238 |
<base:section |
5042 |
11 Aug 09 |
martin |
239 |
id="permissions" |
5042 |
11 Aug 09 |
martin |
240 |
title="<%="Permissions"%>" |
5042 |
11 Aug 09 |
martin |
241 |
context="<%=cc%>" |
5941 |
01 Feb 12 |
nicklas |
242 |
> |
5941 |
01 Feb 12 |
nicklas |
243 |
<% |
5941 |
01 Feb 12 |
nicklas |
244 |
Map<String, List<Item>> permissionGroups = PermissionUtil.getPermissionGroups(); |
5941 |
01 Feb 12 |
nicklas |
245 |
%> |
5941 |
01 Feb 12 |
nicklas |
246 |
<table class="fullform fullborder"> |
5941 |
01 Feb 12 |
nicklas |
247 |
<tbody class="sectionheader"> |
5941 |
01 Feb 12 |
nicklas |
248 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
249 |
<th colspan="<%=permissionGroups.size() * 2 %>">System-level permissions</th> |
5941 |
01 Feb 12 |
nicklas |
250 |
</tr> |
5941 |
01 Feb 12 |
nicklas |
251 |
</tbody> |
2434 |
27 Jun 06 |
nicklas |
252 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
253 |
<th>Share to everyone</th> |
2434 |
27 Jun 06 |
nicklas |
254 |
<td><%=hasShareToEveryone ? "yes" : "no"%></td> |
5941 |
01 Feb 12 |
nicklas |
255 |
<th class="leftborder">Select job agent</th> |
4311 |
23 May 08 |
nicklas |
256 |
<td><%=hasSelectJobagent ? "yes" : "no"%></td> |
5941 |
01 Feb 12 |
nicklas |
257 |
<th class="leftborder">Act as another user</th> |
2434 |
27 Jun 06 |
nicklas |
258 |
<td><%=hasActAsAnotherUser ? "yes" : "no"%></td> |
5941 |
01 Feb 12 |
nicklas |
259 |
<td colspan="<%=permissionGroups.size() * 2 - 6 %>"></td> |
2434 |
27 Jun 06 |
nicklas |
260 |
</tr> |
5941 |
01 Feb 12 |
nicklas |
261 |
<tbody class="sectionheader"> |
5941 |
01 Feb 12 |
nicklas |
262 |
<tr> |
5941 |
01 Feb 12 |
nicklas |
263 |
<% |
5941 |
01 Feb 12 |
nicklas |
264 |
for (String name : permissionGroups.keySet()) |
5941 |
01 Feb 12 |
nicklas |
265 |
{ |
5941 |
01 Feb 12 |
nicklas |
266 |
%> |
5941 |
01 Feb 12 |
nicklas |
267 |
<th colspan="2"><%=name%></th> |
5941 |
01 Feb 12 |
nicklas |
268 |
<% |
5941 |
01 Feb 12 |
nicklas |
269 |
} |
1965 |
10 Feb 06 |
nicklas |
270 |
%> |
5941 |
01 Feb 12 |
nicklas |
271 |
</tr> |
5941 |
01 Feb 12 |
nicklas |
272 |
</tbody> |
1965 |
10 Feb 06 |
nicklas |
273 |
<% |
1965 |
10 Feb 06 |
nicklas |
274 |
int newItems = 0; |
5941 |
01 Feb 12 |
nicklas |
275 |
int rowIndex = 0; |
1965 |
10 Feb 06 |
nicklas |
276 |
do |
1965 |
10 Feb 06 |
nicklas |
277 |
{ |
1965 |
10 Feb 06 |
nicklas |
278 |
newItems = 0; |
5941 |
01 Feb 12 |
nicklas |
279 |
int colIndex = 0; |
1965 |
10 Feb 06 |
nicklas |
280 |
StringBuilder sb = new StringBuilder(); |
5941 |
01 Feb 12 |
nicklas |
281 |
sb.append("<tr>"); |
1965 |
10 Feb 06 |
nicklas |
282 |
for (String name : permissionGroups.keySet()) |
1965 |
10 Feb 06 |
nicklas |
283 |
{ |
1965 |
10 Feb 06 |
nicklas |
284 |
List<Item> items = permissionGroups.get(name); |
5941 |
01 Feb 12 |
nicklas |
285 |
if (items.size() > rowIndex) |
1965 |
10 Feb 06 |
nicklas |
286 |
{ |
1965 |
10 Feb 06 |
nicklas |
287 |
newItems++; |
5941 |
01 Feb 12 |
nicklas |
288 |
Item item = items.get(rowIndex); |
2078 |
15 Mar 06 |
martin |
289 |
int keyId = SystemItems.getRoleKeyId(item); |
2078 |
15 Mar 06 |
martin |
290 |
RoleKey key = RoleKey.getById(dc, keyId); |
2078 |
15 Mar 06 |
martin |
291 |
|
5941 |
01 Feb 12 |
nicklas |
292 |
sb.append("<th"); |
5941 |
01 Feb 12 |
nicklas |
293 |
if (colIndex > 0) sb.append(" class=\"leftborder\""); |
5941 |
01 Feb 12 |
nicklas |
294 |
sb.append(">").append(key.getName()).append("</th>"); |
5941 |
01 Feb 12 |
nicklas |
295 |
sb.append("<td>"); |
2078 |
15 Mar 06 |
martin |
296 |
|
1965 |
10 Feb 06 |
nicklas |
297 |
if (keyId != 0) |
5941 |
01 Feb 12 |
nicklas |
298 |
{ |
1965 |
10 Feb 06 |
nicklas |
299 |
Set<Permission> permissions = key.getPermissions(role); |
1965 |
10 Feb 06 |
nicklas |
300 |
sb.append(getShortPermissions(item, permissions)); |
1965 |
10 Feb 06 |
nicklas |
301 |
} |
1965 |
10 Feb 06 |
nicklas |
302 |
else |
1965 |
10 Feb 06 |
nicklas |
303 |
{ |
1965 |
10 Feb 06 |
nicklas |
304 |
sb.append("(undefined key)"); |
1965 |
10 Feb 06 |
nicklas |
305 |
} |
1965 |
10 Feb 06 |
nicklas |
306 |
sb.append("</td>"); |
1965 |
10 Feb 06 |
nicklas |
307 |
} |
1965 |
10 Feb 06 |
nicklas |
308 |
else |
1965 |
10 Feb 06 |
nicklas |
309 |
{ |
5941 |
01 Feb 12 |
nicklas |
310 |
sb.append("<th class=\"subprompt"); |
5941 |
01 Feb 12 |
nicklas |
311 |
if (colIndex > 0) sb.append(" leftborder"); |
5941 |
01 Feb 12 |
nicklas |
312 |
sb.append("\"></th><td></td>"); |
1965 |
10 Feb 06 |
nicklas |
313 |
} |
5941 |
01 Feb 12 |
nicklas |
314 |
colIndex++; |
1965 |
10 Feb 06 |
nicklas |
315 |
} |
1965 |
10 Feb 06 |
nicklas |
316 |
if (newItems > 0) |
1965 |
10 Feb 06 |
nicklas |
317 |
{ |
1965 |
10 Feb 06 |
nicklas |
318 |
%> |
1965 |
10 Feb 06 |
nicklas |
319 |
<%=sb.toString()%> |
1965 |
10 Feb 06 |
nicklas |
320 |
<% |
1965 |
10 Feb 06 |
nicklas |
321 |
} |
5941 |
01 Feb 12 |
nicklas |
322 |
rowIndex++; |
1965 |
10 Feb 06 |
nicklas |
323 |
} while (newItems > 0); |
1965 |
10 Feb 06 |
nicklas |
324 |
%> |
5941 |
01 Feb 12 |
nicklas |
325 |
</table> |
7216 |
19 Oct 16 |
nicklas |
326 |
<b>C</b> = Create, <b>R</b> = Read, <b>U</b> = Use, <b>A</b> = Annotate, |
4587 |
15 Oct 08 |
martin |
327 |
<b>W</b> = Write, <b>D</b> = Delete, <b>O</b> = Change owner, <b>P</b> = Change permissions |
5042 |
11 Aug 09 |
martin |
328 |
</base:section> |
2434 |
27 Jun 06 |
nicklas |
329 |
<% |
2434 |
27 Jun 06 |
nicklas |
330 |
ItemQuery<User> userQuery = role.getUsers(); |
3890 |
30 Oct 07 |
nicklas |
331 |
userQuery.include(Include.ALL); |
2434 |
27 Jun 06 |
nicklas |
332 |
userQuery.order(Orders.asc(Hql.property("name"))); |
2434 |
27 Jun 06 |
nicklas |
333 |
ItemResultList<User> users = userQuery.list(dc); |
5941 |
01 Feb 12 |
nicklas |
334 |
%> |
5941 |
01 Feb 12 |
nicklas |
335 |
<base:section |
5941 |
01 Feb 12 |
nicklas |
336 |
id="members" |
5941 |
01 Feb 12 |
nicklas |
337 |
title="<%="Members (" + users.size() + ")"%>" |
5941 |
01 Feb 12 |
nicklas |
338 |
context="<%=cc%>" |
5941 |
01 Feb 12 |
nicklas |
339 |
> |
2434 |
27 Jun 06 |
nicklas |
340 |
<% |
5941 |
01 Feb 12 |
nicklas |
341 |
if (users.size() == 0) |
5941 |
01 Feb 12 |
nicklas |
342 |
{ |
5941 |
01 Feb 12 |
nicklas |
343 |
%> |
5941 |
01 Feb 12 |
nicklas |
344 |
<div class="messagecontainer note"> |
5941 |
01 Feb 12 |
nicklas |
345 |
There are no members of this role (or, you don't have permission to view them). |
5941 |
01 Feb 12 |
nicklas |
346 |
</div> |
5941 |
01 Feb 12 |
nicklas |
347 |
<% |
5941 |
01 Feb 12 |
nicklas |
348 |
} |
5941 |
01 Feb 12 |
nicklas |
349 |
else |
5941 |
01 Feb 12 |
nicklas |
350 |
{ |
5941 |
01 Feb 12 |
nicklas |
351 |
%> |
5042 |
11 Aug 09 |
martin |
352 |
<tbl:table |
5042 |
11 Aug 09 |
martin |
353 |
id="members" |
5042 |
11 Aug 09 |
martin |
354 |
columns="all" |
5042 |
11 Aug 09 |
martin |
355 |
> |
5042 |
11 Aug 09 |
martin |
356 |
<tbl:columndef |
5042 |
11 Aug 09 |
martin |
357 |
id="name" |
5042 |
11 Aug 09 |
martin |
358 |
title="Name" |
5042 |
11 Aug 09 |
martin |
359 |
/> |
5042 |
11 Aug 09 |
martin |
360 |
<tbl:columndef |
5042 |
11 Aug 09 |
martin |
361 |
id="type" |
5042 |
11 Aug 09 |
martin |
362 |
title="Type" |
5042 |
11 Aug 09 |
martin |
363 |
/> |
5042 |
11 Aug 09 |
martin |
364 |
<tbl:columndef |
5042 |
11 Aug 09 |
martin |
365 |
id="description" |
5042 |
11 Aug 09 |
martin |
366 |
title="Description" |
5042 |
11 Aug 09 |
martin |
367 |
/> |
5042 |
11 Aug 09 |
martin |
368 |
<tbl:data> |
5941 |
01 Feb 12 |
nicklas |
369 |
<tbl:headers> |
5941 |
01 Feb 12 |
nicklas |
370 |
<tbl:headerrow> |
5941 |
01 Feb 12 |
nicklas |
371 |
<tbl:columnheaders /> |
5941 |
01 Feb 12 |
nicklas |
372 |
</tbl:headerrow> |
5941 |
01 Feb 12 |
nicklas |
373 |
</tbl:headers> |
5042 |
11 Aug 09 |
martin |
374 |
<tbl:rows> |
5042 |
11 Aug 09 |
martin |
375 |
<% |
5042 |
11 Aug 09 |
martin |
376 |
for (User user : users) |
5042 |
11 Aug 09 |
martin |
377 |
{ |
5042 |
11 Aug 09 |
martin |
378 |
%> |
5042 |
11 Aug 09 |
martin |
379 |
<tbl:row> |
5042 |
11 Aug 09 |
martin |
380 |
<tbl:cell column="name"><base:icon |
5946 |
03 Feb 12 |
nicklas |
381 |
image="deleted.png" |
5042 |
11 Aug 09 |
martin |
382 |
tooltip="This item has been scheduled for deletion" |
5042 |
11 Aug 09 |
martin |
383 |
visible="<%=user.isRemoved()%>" |
5042 |
11 Aug 09 |
martin |
384 |
/><%=Base.getLinkedName(ID, user, false, true)%></tbl:cell> |
5042 |
11 Aug 09 |
martin |
385 |
<tbl:cell column="type">User</tbl:cell> |
5042 |
11 Aug 09 |
martin |
386 |
<tbl:cell column="description"><%=HTML.encodeTags(user.getDescription())%></tbl:cell> |
5042 |
11 Aug 09 |
martin |
387 |
</tbl:row> |
5042 |
11 Aug 09 |
martin |
388 |
<% |
5042 |
11 Aug 09 |
martin |
389 |
} |
2434 |
27 Jun 06 |
nicklas |
390 |
%> |
5042 |
11 Aug 09 |
martin |
391 |
</tbl:rows> |
5042 |
11 Aug 09 |
martin |
392 |
</tbl:data> |
5042 |
11 Aug 09 |
martin |
393 |
</tbl:table> |
5941 |
01 Feb 12 |
nicklas |
394 |
<% |
5941 |
01 Feb 12 |
nicklas |
395 |
} |
5941 |
01 Feb 12 |
nicklas |
396 |
%> |
5941 |
01 Feb 12 |
nicklas |
397 |
</base:section> |
5507 |
19 Nov 10 |
nicklas |
398 |
<jsp:include page="../../common/anytoany/list_anytoany.jsp"> |
5507 |
19 Nov 10 |
nicklas |
399 |
<jsp:param name="ID" value="<%=ID%>" /> |
5507 |
19 Nov 10 |
nicklas |
400 |
<jsp:param name="item_type" value="<%=itemType.name()%>" /> |
5507 |
19 Nov 10 |
nicklas |
401 |
<jsp:param name="item_id" value="<%=itemId%>" /> |
5507 |
19 Nov 10 |
nicklas |
402 |
<jsp:param name="title" value="Other items related to this role" /> |
5507 |
19 Nov 10 |
nicklas |
403 |
</jsp:include> |
5941 |
01 Feb 12 |
nicklas |
404 |
</t:tab> |
5941 |
01 Feb 12 |
nicklas |
405 |
</t:tabcontrol> |
1965 |
10 Feb 06 |
nicklas |
406 |
</base:body> |
1965 |
10 Feb 06 |
nicklas |
407 |
</base:page> |
1965 |
10 Feb 06 |
nicklas |
408 |
<% |
1965 |
10 Feb 06 |
nicklas |
409 |
} |
1965 |
10 Feb 06 |
nicklas |
410 |
finally |
1965 |
10 Feb 06 |
nicklas |
411 |
{ |
1965 |
10 Feb 06 |
nicklas |
412 |
if (dc != null) dc.close(); |
1965 |
10 Feb 06 |
nicklas |
413 |
} |
1965 |
10 Feb 06 |
nicklas |
414 |
|
1965 |
10 Feb 06 |
nicklas |
415 |
%> |