465 |
26 Apr 05 |
nicklas |
1 |
<%-- $Id$ |
465 |
26 Apr 05 |
nicklas |
2 |
------------------------------------------------------------------ |
3675 |
16 Aug 07 |
jari |
Copyright (C) 2005 Nicklas Nordborg |
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 |
465 |
26 Apr 05 |
nicklas |
6 |
|
2304 |
22 May 06 |
jari |
7 |
This file is part of BASE - BioArray Software Environment. |
2304 |
22 May 06 |
jari |
8 |
Available at http://base.thep.lu.se/ |
465 |
26 Apr 05 |
nicklas |
9 |
|
465 |
26 Apr 05 |
nicklas |
10 |
BASE is free software; you can redistribute it and/or |
465 |
26 Apr 05 |
nicklas |
11 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
12 |
as published by the Free Software Foundation; either version 3 |
465 |
26 Apr 05 |
nicklas |
13 |
of the License, or (at your option) any later version. |
465 |
26 Apr 05 |
nicklas |
14 |
|
465 |
26 Apr 05 |
nicklas |
15 |
BASE is distributed in the hope that it will be useful, |
465 |
26 Apr 05 |
nicklas |
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
465 |
26 Apr 05 |
nicklas |
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
465 |
26 Apr 05 |
nicklas |
18 |
GNU General Public License for more details. |
465 |
26 Apr 05 |
nicklas |
19 |
|
465 |
26 Apr 05 |
nicklas |
20 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
21 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
465 |
26 Apr 05 |
nicklas |
22 |
------------------------------------------------------------------ |
465 |
26 Apr 05 |
nicklas |
23 |
|
465 |
26 Apr 05 |
nicklas |
24 |
|
465 |
26 Apr 05 |
nicklas |
25 |
@author Nicklas |
465 |
26 Apr 05 |
nicklas |
26 |
@version 2.0 |
465 |
26 Apr 05 |
nicklas |
27 |
--%> |
5426 |
24 Sep 10 |
nicklas |
28 |
<%@ page pageEncoding="UTF-8" session="false" |
465 |
26 Apr 05 |
nicklas |
29 |
import="net.sf.basedb.core.SessionControl" |
465 |
26 Apr 05 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
545 |
10 May 05 |
nicklas |
31 |
import="net.sf.basedb.core.SystemItems" |
465 |
26 Apr 05 |
nicklas |
32 |
import="net.sf.basedb.core.Item" |
1965 |
10 Feb 06 |
nicklas |
33 |
import="net.sf.basedb.core.ItemContext" |
3890 |
30 Oct 07 |
nicklas |
34 |
import="net.sf.basedb.core.Include" |
465 |
26 Apr 05 |
nicklas |
35 |
import="net.sf.basedb.core.Permission" |
1965 |
10 Feb 06 |
nicklas |
36 |
import="net.sf.basedb.core.User" |
465 |
26 Apr 05 |
nicklas |
37 |
import="net.sf.basedb.core.Role" |
477 |
27 Apr 05 |
nicklas |
38 |
import="net.sf.basedb.core.RoleKey" |
1418 |
07 Oct 05 |
nicklas |
39 |
import="net.sf.basedb.core.ItemQuery" |
1965 |
10 Feb 06 |
nicklas |
40 |
import="net.sf.basedb.core.ItemResultList" |
545 |
10 May 05 |
nicklas |
41 |
import="net.sf.basedb.core.BaseException" |
1965 |
10 Feb 06 |
nicklas |
42 |
import="net.sf.basedb.core.PermissionDeniedException" |
518 |
03 May 05 |
nicklas |
43 |
import="net.sf.basedb.core.query.Orders" |
1418 |
07 Oct 05 |
nicklas |
44 |
import="net.sf.basedb.core.query.Hql" |
465 |
26 Apr 05 |
nicklas |
45 |
import="net.sf.basedb.clients.web.Base" |
1965 |
10 Feb 06 |
nicklas |
46 |
import="net.sf.basedb.clients.web.PermissionUtil" |
465 |
26 Apr 05 |
nicklas |
47 |
import="net.sf.basedb.clients.web.util.HTML" |
2753 |
20 Oct 06 |
nicklas |
48 |
import="net.sf.basedb.util.Values" |
5506 |
19 Nov 10 |
nicklas |
49 |
import="net.sf.basedb.core.plugin.GuiContext" |
5506 |
19 Nov 10 |
nicklas |
50 |
import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
5506 |
19 Nov 10 |
nicklas |
51 |
import="net.sf.basedb.clients.web.extensions.JspContext" |
5506 |
19 Nov 10 |
nicklas |
52 |
import="net.sf.basedb.clients.web.extensions.edit.EditUtil" |
7604 |
25 Feb 19 |
nicklas |
53 |
import="net.sf.basedb.clients.web.extensions.tabcontrol.TabAction" |
5506 |
19 Nov 10 |
nicklas |
54 |
import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
6224 |
15 Jan 13 |
nicklas |
55 |
import="net.sf.basedb.util.json.JsonUtil" |
6224 |
15 Jan 13 |
nicklas |
56 |
import="net.sf.basedb.util.json.NameableConverter" |
477 |
27 Apr 05 |
nicklas |
57 |
import="java.util.EnumSet" |
545 |
10 May 05 |
nicklas |
58 |
import="java.util.Set" |
1965 |
10 Feb 06 |
nicklas |
59 |
import="java.util.Map" |
1965 |
10 Feb 06 |
nicklas |
60 |
import="java.util.List" |
6224 |
15 Jan 13 |
nicklas |
61 |
import="org.json.simple.JSONArray" |
6291 |
11 Jun 13 |
nicklas |
62 |
import="org.json.simple.JSONObject" |
465 |
26 Apr 05 |
nicklas |
63 |
%> |
465 |
26 Apr 05 |
nicklas |
64 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
465 |
26 Apr 05 |
nicklas |
65 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
6147 |
21 Sep 12 |
nicklas |
66 |
<%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
545 |
10 May 05 |
nicklas |
67 |
<%! |
1965 |
10 Feb 06 |
nicklas |
68 |
private static final int DENY_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.DENIED)); |
1965 |
10 Feb 06 |
nicklas |
69 |
private static final int CREATE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.CREATE)); |
1965 |
10 Feb 06 |
nicklas |
70 |
private static final int READ_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.READ)); |
1965 |
10 Feb 06 |
nicklas |
71 |
private static final int USE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.USE)); |
7216 |
19 Oct 16 |
nicklas |
72 |
private static final int RESTRICTED_WRITE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.RESTRICTED_WRITE)); |
1965 |
10 Feb 06 |
nicklas |
73 |
private static final int WRITE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.WRITE)); |
1965 |
10 Feb 06 |
nicklas |
74 |
private static final int DELETE_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.DELETE)); |
1965 |
10 Feb 06 |
nicklas |
75 |
private static final int SET_OWNER_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.SET_OWNER)); |
1965 |
10 Feb 06 |
nicklas |
76 |
private static final int SET_PERMISSION_CODE = PermissionUtil.getPermissionCode(EnumSet.of(Permission.SET_PERMISSION)); |
598 |
16 May 05 |
nicklas |
77 |
|
545 |
10 May 05 |
nicklas |
78 |
private String getOption(DbControl dc, Role role, Item itemType) |
545 |
10 May 05 |
nicklas |
79 |
throws BaseException |
545 |
10 May 05 |
nicklas |
80 |
{ |
1965 |
10 Feb 06 |
nicklas |
81 |
int keyId = SystemItems.getRoleKeyId(itemType); |
1965 |
10 Feb 06 |
nicklas |
82 |
if (keyId == 0) return ""; |
1965 |
10 Feb 06 |
nicklas |
83 |
|
1965 |
10 Feb 06 |
nicklas |
84 |
RoleKey key = RoleKey.getById(dc, keyId); |
1965 |
10 Feb 06 |
nicklas |
85 |
Set<Permission> permissions = role == null ? EnumSet.noneOf(Permission.class) : key.getPermissions(role); |
545 |
10 May 05 |
nicklas |
86 |
StringBuilder sb = new StringBuilder(); |
614 |
18 May 05 |
nicklas |
87 |
sb.append("<option value=\"").append(key.getItemType().name()).append("\">"); |
545 |
10 May 05 |
nicklas |
88 |
sb.append(HTML.encodeTags(key.getName())); |
545 |
10 May 05 |
nicklas |
89 |
sb.append(" ["); |
545 |
10 May 05 |
nicklas |
90 |
if (permissions.contains(Permission.DENIED)) |
545 |
10 May 05 |
nicklas |
91 |
{ |
545 |
10 May 05 |
nicklas |
92 |
sb.append("DENIED"); |
545 |
10 May 05 |
nicklas |
93 |
} |
545 |
10 May 05 |
nicklas |
94 |
else |
545 |
10 May 05 |
nicklas |
95 |
{ |
545 |
10 May 05 |
nicklas |
96 |
Set<Permission> defined = itemType.getDefinedPermissions(); |
545 |
10 May 05 |
nicklas |
97 |
if (defined != null) |
545 |
10 May 05 |
nicklas |
98 |
{ |
599 |
17 May 05 |
nicklas |
99 |
if (defined.contains(Permission.CREATE)) sb.append(permissions.contains(Permission.CREATE) ? "C" : "-"); |
599 |
17 May 05 |
nicklas |
100 |
if (defined.contains(Permission.READ)) sb.append(permissions.contains(Permission.READ) ? "R" : "-"); |
599 |
17 May 05 |
nicklas |
101 |
if (defined.contains(Permission.USE)) sb.append(permissions.contains(Permission.USE) ? "U" : "-"); |
7216 |
19 Oct 16 |
nicklas |
102 |
if (defined.contains(Permission.RESTRICTED_WRITE)) sb.append(permissions.contains(Permission.RESTRICTED_WRITE) ? "A" : "-"); |
599 |
17 May 05 |
nicklas |
103 |
if (defined.contains(Permission.WRITE)) sb.append(permissions.contains(Permission.WRITE) ? "W" : "-"); |
599 |
17 May 05 |
nicklas |
104 |
if (defined.contains(Permission.DELETE)) sb.append(permissions.contains(Permission.DELETE) ? "D" : "-"); |
599 |
17 May 05 |
nicklas |
105 |
if (defined.contains(Permission.SET_OWNER)) sb.append(permissions.contains(Permission.SET_OWNER) ? "O" : "-"); |
599 |
17 May 05 |
nicklas |
106 |
if (defined.contains(Permission.SET_PERMISSION)) sb.append(permissions.contains(Permission.SET_PERMISSION) ? "P" : "-"); |
545 |
10 May 05 |
nicklas |
107 |
} |
545 |
10 May 05 |
nicklas |
108 |
} |
545 |
10 May 05 |
nicklas |
109 |
sb.append("]"); |
545 |
10 May 05 |
nicklas |
110 |
return sb.toString(); |
545 |
10 May 05 |
nicklas |
111 |
} |
545 |
10 May 05 |
nicklas |
112 |
%> |
465 |
26 Apr 05 |
nicklas |
113 |
<% |
1965 |
10 Feb 06 |
nicklas |
114 |
final Item itemType = Item.ROLE; |
1965 |
10 Feb 06 |
nicklas |
115 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1965 |
10 Feb 06 |
nicklas |
116 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null); |
1965 |
10 Feb 06 |
nicklas |
117 |
final int itemId = cc.getId(); |
465 |
26 Apr 05 |
nicklas |
118 |
final String ID = sc.getId(); |
465 |
26 Apr 05 |
nicklas |
119 |
final float scale = Base.getScale(sc); |
7954 |
12 May 21 |
nicklas |
120 |
final DbControl dc = sc.newDbControl(":Edit "+itemType); |
465 |
26 Apr 05 |
nicklas |
121 |
try |
465 |
26 Apr 05 |
nicklas |
122 |
{ |
465 |
26 Apr 05 |
nicklas |
123 |
String title = null; |
465 |
26 Apr 05 |
nicklas |
124 |
Role role = null; |
3467 |
08 Jun 07 |
nicklas |
125 |
boolean isDefault = false; |
1965 |
10 Feb 06 |
nicklas |
126 |
|
1965 |
10 Feb 06 |
nicklas |
127 |
if (itemId == 0) |
465 |
26 Apr 05 |
nicklas |
128 |
{ |
465 |
26 Apr 05 |
nicklas |
129 |
title = "Create role"; |
1965 |
10 Feb 06 |
nicklas |
130 |
cc.removeObject("item"); |
3467 |
08 Jun 07 |
nicklas |
131 |
isDefault = Values.getBoolean(cc.getPropertyValue("default"), false); |
465 |
26 Apr 05 |
nicklas |
132 |
} |
465 |
26 Apr 05 |
nicklas |
133 |
else |
465 |
26 Apr 05 |
nicklas |
134 |
{ |
1965 |
10 Feb 06 |
nicklas |
135 |
role = Role.getById(dc, itemId); |
6291 |
11 Jun 13 |
nicklas |
136 |
role.checkPermission(Permission.WRITE); |
1965 |
10 Feb 06 |
nicklas |
137 |
cc.setObject("item", role); |
3467 |
08 Jun 07 |
nicklas |
138 |
isDefault = role.isDefault(); |
518 |
03 May 05 |
nicklas |
139 |
title = "Edit role -- " + HTML.encodeTags(role.getName()); |
1965 |
10 Feb 06 |
nicklas |
140 |
|
465 |
26 Apr 05 |
nicklas |
141 |
} |
1965 |
10 Feb 06 |
nicklas |
142 |
|
1965 |
10 Feb 06 |
nicklas |
143 |
final boolean useUsers = sc.hasPermission(Permission.WRITE, Item.USER); |
599 |
17 May 05 |
nicklas |
144 |
RoleKey system = RoleKey.getById(dc, SystemItems.getRoleKeyId(Item.SYSTEM)); |
1965 |
10 Feb 06 |
nicklas |
145 |
final boolean hasShareToEveryone = role == null ? false : system.getPermissions(role).contains(Permission.SHARE_TO_EVERYONE); |
1965 |
10 Feb 06 |
nicklas |
146 |
final boolean hasActAsAnotherUser = role == null ? false : system.getPermissions(role).contains(Permission.ACT_AS_ANOTHER_USER); |
4311 |
23 May 08 |
nicklas |
147 |
final boolean hasSelectJobagent = role == null ? false : system.getPermissions(role).contains(Permission.SELECT_JOBAGENT); |
518 |
03 May 05 |
nicklas |
148 |
|
518 |
03 May 05 |
nicklas |
149 |
// Query to retrieve role keys |
1418 |
07 Oct 05 |
nicklas |
150 |
final ItemQuery<RoleKey> roleKeyQuery = RoleKey.getQuery(); |
1418 |
07 Oct 05 |
nicklas |
151 |
roleKeyQuery.order(Orders.asc(Hql.property("name"))); |
518 |
03 May 05 |
nicklas |
152 |
|
6291 |
11 Jun 13 |
nicklas |
153 |
// Load user members as JSON objects |
6291 |
11 Jun 13 |
nicklas |
154 |
JSONObject jsonUsers = new JSONObject(); |
6291 |
11 Jun 13 |
nicklas |
155 |
jsonUsers.put("itemType", "USER"); |
1965 |
10 Feb 06 |
nicklas |
156 |
if (role != null) |
1965 |
10 Feb 06 |
nicklas |
157 |
{ |
6291 |
11 Jun 13 |
nicklas |
158 |
ItemQuery<User> query = role.getUsers(); |
6291 |
11 Jun 13 |
nicklas |
159 |
query.include(Include.ALL); |
6291 |
11 Jun 13 |
nicklas |
160 |
query.order(Orders.asc(Hql.property("name"))); |
7604 |
25 Feb 19 |
nicklas |
161 |
jsonUsers.put("items", JsonUtil.toArray(query.iterate(dc), new NameableConverter<User>())); |
1965 |
10 Feb 06 |
nicklas |
162 |
} |
1965 |
10 Feb 06 |
nicklas |
163 |
|
5506 |
19 Nov 10 |
nicklas |
164 |
JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), role); |
7604 |
25 Feb 19 |
nicklas |
165 |
ExtensionsInvoker<TabAction> invoker = EditUtil.useEditExtensions(jspContext); |
465 |
26 Apr 05 |
nicklas |
166 |
%> |
6224 |
15 Jan 13 |
nicklas |
167 |
<base:page type="popup" title="<%=title%>" id="edit-page"> |
6291 |
11 Jun 13 |
nicklas |
168 |
<base:head scripts="tabcontrol-2.js,linkitems-2.js,~roles.js" styles="tabcontrol.css"> |
5506 |
19 Nov 10 |
nicklas |
169 |
<ext:scripts context="<%=jspContext%>" /> |
5506 |
19 Nov 10 |
nicklas |
170 |
<ext:stylesheets context="<%=jspContext%>" /> |
6224 |
15 Jan 13 |
nicklas |
171 |
</base:head> |
6224 |
15 Jan 13 |
nicklas |
172 |
<base:body> |
6224 |
15 Jan 13 |
nicklas |
173 |
<h1><%=title%> <base:help tabcontrol="settings" /></h1> |
614 |
18 May 05 |
nicklas |
174 |
|
6162 |
10 Oct 12 |
nicklas |
175 |
<form action="index.jsp?ID=<%=ID%>" method="post" name="role"> |
1965 |
10 Feb 06 |
nicklas |
176 |
<input type="hidden" name="cmd" value="UpdateItem"> |
1965 |
10 Feb 06 |
nicklas |
177 |
|
5921 |
10 Jan 12 |
nicklas |
178 |
<t:tabcontrol id="settings" |
5921 |
10 Jan 12 |
nicklas |
179 |
subclass="content dialogtabcontrol" |
5506 |
19 Nov 10 |
nicklas |
180 |
position="bottom" remember="<%=role != null%>" |
5506 |
19 Nov 10 |
nicklas |
181 |
extensions="<%=invoker%>"> |
6224 |
15 Jan 13 |
nicklas |
182 |
<t:tab id="info" title="Role" helpid="role.edit"> |
5921 |
10 Jan 12 |
nicklas |
183 |
<table class="fullform input100"> |
465 |
26 Apr 05 |
nicklas |
184 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
185 |
<th>Name</th> |
6224 |
15 Jan 13 |
nicklas |
186 |
<td><input class="text required auto-init" data-auto-init="<%=role == null ? "focus-select" : "focus" %>" |
6224 |
15 Jan 13 |
nicklas |
187 |
type="text" name="name" |
1965 |
10 Feb 06 |
nicklas |
188 |
value="<%=HTML.encodeTags(role == null ? Values.getString(cc.getPropertyValue("name"), "New role") : role.getName())%>" |
5921 |
10 Jan 12 |
nicklas |
189 |
maxlength="<%=Role.MAX_NAME_LENGTH%>"></td> |
5921 |
10 Jan 12 |
nicklas |
190 |
<td></td> |
465 |
26 Apr 05 |
nicklas |
191 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
192 |
<tr class="big"> |
5921 |
10 Jan 12 |
nicklas |
193 |
<th>System-level<br>permissions</th> |
599 |
17 May 05 |
nicklas |
194 |
<td> |
6224 |
15 Jan 13 |
nicklas |
195 |
<input type="checkbox" name="share_to_everyone" id="share_to_everyone" |
6224 |
15 Jan 13 |
nicklas |
196 |
value="<%=PermissionUtil.getPermissionCode(EnumSet.of(Permission.SHARE_TO_EVERYONE))%>" |
618 |
19 May 05 |
nicklas |
197 |
<%=hasShareToEveryone ? "checked" : ""%> |
5921 |
10 Jan 12 |
nicklas |
198 |
><label for="share_to_everyone">Share to Everyone</label><br> |
6224 |
15 Jan 13 |
nicklas |
199 |
<input type="checkbox" name="act_as_another_user" id="act_as_another_user" |
6224 |
15 Jan 13 |
nicklas |
200 |
value="<%=PermissionUtil.getPermissionCode(EnumSet.of(Permission.ACT_AS_ANOTHER_USER))%>" |
618 |
19 May 05 |
nicklas |
201 |
<%=hasActAsAnotherUser ? "checked" : ""%> |
5921 |
10 Jan 12 |
nicklas |
202 |
><label for="act_as_another_user">Act as another user</label><br> |
6224 |
15 Jan 13 |
nicklas |
203 |
<input type="checkbox" name="select_jobagent" id="select_jobagent" |
6684 |
14 Jan 15 |
nicklas |
204 |
value="<%=PermissionUtil.getPermissionCode(EnumSet.of(Permission.SELECT_JOBAGENT))%>" |
4311 |
23 May 08 |
nicklas |
205 |
<%=hasSelectJobagent ? "checked" : ""%> |
5921 |
10 Jan 12 |
nicklas |
206 |
><label for="select_jobagent">Select job agent for jobs</label><br> |
599 |
17 May 05 |
nicklas |
207 |
</td> |
5921 |
10 Jan 12 |
nicklas |
208 |
<td></td> |
1965 |
10 Feb 06 |
nicklas |
209 |
</tr> |
3467 |
08 Jun 07 |
nicklas |
210 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
211 |
<th>Default</th> |
3467 |
08 Jun 07 |
nicklas |
212 |
<td> |
5812 |
17 Oct 11 |
nicklas |
213 |
<input type="radio" name="is_default" id="defaultNo" value="0" |
5812 |
17 Oct 11 |
nicklas |
214 |
<%=!isDefault ? "checked" : ""%>><label for="defaultNo">no</label> |
5812 |
17 Oct 11 |
nicklas |
215 |
<input type="radio" name="is_default" id="defaultYes" value="1" |
5812 |
17 Oct 11 |
nicklas |
216 |
<%=isDefault ? "checked" : ""%>><label for="defaultYes">yes</label> |
3467 |
08 Jun 07 |
nicklas |
217 |
</td> |
5921 |
10 Jan 12 |
nicklas |
218 |
<td></td> |
3467 |
08 Jun 07 |
nicklas |
219 |
</tr> |
3467 |
08 Jun 07 |
nicklas |
220 |
|
5921 |
10 Jan 12 |
nicklas |
221 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
222 |
<th>Description</th> |
6147 |
21 Sep 12 |
nicklas |
223 |
<td> |
6217 |
14 Dec 12 |
nicklas |
224 |
<textarea class="text" rows="6" name="description" id="description" |
1965 |
10 Feb 06 |
nicklas |
225 |
><%=HTML.encodeTags(role == null ? cc.getPropertyValue("description") : role.getDescription())%></textarea> |
1965 |
10 Feb 06 |
nicklas |
226 |
</td> |
5921 |
10 Jan 12 |
nicklas |
227 |
<td style="width: 20px;"> |
6215 |
13 Dec 12 |
nicklas |
228 |
<base:zoom textarea="description" title="Description" /> |
5921 |
10 Jan 12 |
nicklas |
229 |
</td> |
1965 |
10 Feb 06 |
nicklas |
230 |
</tr> |
465 |
26 Apr 05 |
nicklas |
231 |
</table> |
465 |
26 Apr 05 |
nicklas |
232 |
</t:tab> |
465 |
26 Apr 05 |
nicklas |
233 |
|
2434 |
27 Jun 06 |
nicklas |
234 |
<t:tab id="permissions" title="Permissions" |
2434 |
27 Jun 06 |
nicklas |
235 |
tooltip="Set permissions for this role" helpid="role.edit.permissions"> |
5922 |
11 Jan 12 |
nicklas |
236 |
<table class="fullform input100"> |
5921 |
10 Jan 12 |
nicklas |
237 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
238 |
<th>Item types</th> |
5921 |
10 Jan 12 |
nicklas |
239 |
<td> |
5922 |
11 Jan 12 |
nicklas |
240 |
<div class="selectionlist"> |
5921 |
10 Jan 12 |
nicklas |
241 |
<table> |
5921 |
10 Jan 12 |
nicklas |
242 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
243 |
<td> |
6224 |
15 Jan 13 |
nicklas |
244 |
<select name="items" size="15" id="items" multiple> |
5921 |
10 Jan 12 |
nicklas |
245 |
<% |
5921 |
10 Jan 12 |
nicklas |
246 |
Map<String, List<Item>> permissionGroups = PermissionUtil.getPermissionGroups(); |
5921 |
10 Jan 12 |
nicklas |
247 |
for (Map.Entry<String, List<Item>> entry : permissionGroups.entrySet()) |
5921 |
10 Jan 12 |
nicklas |
248 |
{ |
5921 |
10 Jan 12 |
nicklas |
249 |
String name = entry.getKey(); |
5921 |
10 Jan 12 |
nicklas |
250 |
List<Item> items = entry.getValue(); |
5921 |
10 Jan 12 |
nicklas |
251 |
%> |
5921 |
10 Jan 12 |
nicklas |
252 |
<option class="selectoptionheader" value="">-- <%=name%> |
5921 |
10 Jan 12 |
nicklas |
253 |
<% |
5921 |
10 Jan 12 |
nicklas |
254 |
for (Item item : items) |
5921 |
10 Jan 12 |
nicklas |
255 |
{ |
5921 |
10 Jan 12 |
nicklas |
256 |
%> |
5921 |
10 Jan 12 |
nicklas |
257 |
<%=getOption(dc, role, item)%> |
5921 |
10 Jan 12 |
nicklas |
258 |
<% |
5921 |
10 Jan 12 |
nicklas |
259 |
} |
5921 |
10 Jan 12 |
nicklas |
260 |
} |
1965 |
10 Feb 06 |
nicklas |
261 |
%> |
5921 |
10 Jan 12 |
nicklas |
262 |
</select> |
5921 |
10 Jan 12 |
nicklas |
263 |
</td> |
5922 |
11 Jan 12 |
nicklas |
264 |
<td style="vertical-align: top;"> |
5922 |
11 Jan 12 |
nicklas |
265 |
<div style="width: 15em;"> |
5921 |
10 Jan 12 |
nicklas |
266 |
<b>Permissions</b><br> |
6224 |
15 Jan 13 |
nicklas |
267 |
<input type="checkbox" name="deny" id="deny" value="<%=DENY_CODE%>"><label for="deny">Deny</label><br> |
6224 |
15 Jan 13 |
nicklas |
268 |
<input type="checkbox" name="create" id="create" value="<%=CREATE_CODE%>"><label for="create">Create</label><br> |
6224 |
15 Jan 13 |
nicklas |
269 |
<input type="checkbox" name="read" id="read" value="<%=READ_CODE%>"><label for="read">Read</label><br> |
6224 |
15 Jan 13 |
nicklas |
270 |
<input type="checkbox" name="use" id="use" value="<%=USE_CODE%>"><label for="use">Use</label><br> |
7216 |
19 Oct 16 |
nicklas |
271 |
<input type="checkbox" name="restricted_write" id="restricted_write" value="<%=RESTRICTED_WRITE_CODE%>"><label for="restricted_write">Annotate</label><br> |
6224 |
15 Jan 13 |
nicklas |
272 |
<input type="checkbox" name="write" id="write" value="<%=WRITE_CODE%>"><label for="write">Write</label><br> |
6224 |
15 Jan 13 |
nicklas |
273 |
<input type="checkbox" name="delete" id="delete" value="<%=DELETE_CODE%>"><label for="delete">Delete</label><br> |
6224 |
15 Jan 13 |
nicklas |
274 |
<input type="checkbox" name="set_owner" id="set_owner" value="<%=SET_OWNER_CODE%>"><label for="set_owner">Set owner</label><br> |
6224 |
15 Jan 13 |
nicklas |
275 |
<input type="checkbox" name="set_permission" id="set_permission" value="<%=SET_PERMISSION_CODE%>"><label for="set_permission">Set permission</label><br> |
5922 |
11 Jan 12 |
nicklas |
276 |
</div> |
5922 |
11 Jan 12 |
nicklas |
277 |
</td> |
5921 |
10 Jan 12 |
nicklas |
278 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
279 |
</table> |
5922 |
11 Jan 12 |
nicklas |
280 |
</div> |
477 |
27 Apr 05 |
nicklas |
281 |
</td> |
5921 |
10 Jan 12 |
nicklas |
282 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
283 |
</table> |
465 |
26 Apr 05 |
nicklas |
284 |
</t:tab> |
465 |
26 Apr 05 |
nicklas |
285 |
|
2434 |
27 Jun 06 |
nicklas |
286 |
<t:tab id="members" title="Members" tooltip="Add/remove members of this role" |
6224 |
15 Jan 13 |
nicklas |
287 |
helpid="role.edit.members"> |
5922 |
11 Jan 12 |
nicklas |
288 |
<table class="fullform input100"> |
5921 |
10 Jan 12 |
nicklas |
289 |
<tr class="dynamic"> |
5921 |
10 Jan 12 |
nicklas |
290 |
<th>Members</th> |
5921 |
10 Jan 12 |
nicklas |
291 |
<td> |
5921 |
10 Jan 12 |
nicklas |
292 |
<div class="selectionlist"> |
5921 |
10 Jan 12 |
nicklas |
293 |
<table> |
5921 |
10 Jan 12 |
nicklas |
294 |
<tr> |
5921 |
10 Jan 12 |
nicklas |
295 |
<td> |
6291 |
11 Jun 13 |
nicklas |
296 |
<select name="members" id="members" |
6291 |
11 Jun 13 |
nicklas |
297 |
class="auto-init" data-auto-init="link-container" |
6291 |
11 Jun 13 |
nicklas |
298 |
data-initial-items="[<%=HTML.encodeTags(jsonUsers.toJSONString()) %>]" |
6291 |
11 Jun 13 |
nicklas |
299 |
data-initial-action="<%=role == null ? 0 : 1%>" |
6291 |
11 Jun 13 |
nicklas |
300 |
size="15" multiple <%=!useUsers ? "disabled readonly class=\"disabled\"" : ""%>> |
5921 |
10 Jan 12 |
nicklas |
301 |
</select> |
5921 |
10 Jan 12 |
nicklas |
302 |
</td> |
5921 |
10 Jan 12 |
nicklas |
303 |
<td style="vertical-align: top;"> |
5921 |
10 Jan 12 |
nicklas |
304 |
<base:buttongroup vertical="true"> |
5921 |
10 Jan 12 |
nicklas |
305 |
<base:button |
6224 |
15 Jan 13 |
nicklas |
306 |
id="btnAddUsers" |
6291 |
11 Jun 13 |
nicklas |
307 |
subclass="leftaligned auto-init" |
6291 |
11 Jun 13 |
nicklas |
308 |
data-auto-init="add-link" |
6291 |
11 Jun 13 |
nicklas |
309 |
data-list-id="members" |
6291 |
11 Jun 13 |
nicklas |
310 |
data-item-type="USER" |
5921 |
10 Jan 12 |
nicklas |
311 |
style="width: 12em;" |
5921 |
10 Jan 12 |
nicklas |
312 |
title="Add users…" |
5921 |
10 Jan 12 |
nicklas |
313 |
tooltip="Add users to this role" |
5921 |
10 Jan 12 |
nicklas |
314 |
disabled="<%=!useUsers %>" |
5921 |
10 Jan 12 |
nicklas |
315 |
/> |
5921 |
10 Jan 12 |
nicklas |
316 |
<base:button |
6224 |
15 Jan 13 |
nicklas |
317 |
id="btnRemoveUsers" |
6291 |
11 Jun 13 |
nicklas |
318 |
subclass="leftaligned auto-init" |
6291 |
11 Jun 13 |
nicklas |
319 |
data-auto-init="remove-link" |
6291 |
11 Jun 13 |
nicklas |
320 |
data-list-id="members" |
5921 |
10 Jan 12 |
nicklas |
321 |
style="width: 12em;" |
5921 |
10 Jan 12 |
nicklas |
322 |
title="Remove" |
5921 |
10 Jan 12 |
nicklas |
323 |
tooltip="Remove the selected items from this role" |
5921 |
10 Jan 12 |
nicklas |
324 |
disabled="<%=!useUsers%>" |
5921 |
10 Jan 12 |
nicklas |
325 |
/> |
5921 |
10 Jan 12 |
nicklas |
326 |
</base:buttongroup> |
5921 |
10 Jan 12 |
nicklas |
327 |
</td> |
5921 |
10 Jan 12 |
nicklas |
328 |
</tr> |
5921 |
10 Jan 12 |
nicklas |
329 |
</table> |
5921 |
10 Jan 12 |
nicklas |
330 |
</div> |
5921 |
10 Jan 12 |
nicklas |
331 |
</td> |
5921 |
10 Jan 12 |
nicklas |
332 |
</tr> |
522 |
04 May 05 |
nicklas |
333 |
</table> |
465 |
26 Apr 05 |
nicklas |
334 |
</t:tab> |
465 |
26 Apr 05 |
nicklas |
335 |
</t:tabcontrol> |
477 |
27 Apr 05 |
nicklas |
336 |
<% |
1965 |
10 Feb 06 |
nicklas |
337 |
ItemResultList<RoleKey> roleKeys = roleKeyQuery.list(dc); |
1965 |
10 Feb 06 |
nicklas |
338 |
for (RoleKey key : roleKeys) |
477 |
27 Apr 05 |
nicklas |
339 |
{ |
1965 |
10 Feb 06 |
nicklas |
340 |
int permissionCode = role == null ? 0 : PermissionUtil.getPermissionCode(key.getPermissions(role)); |
1965 |
10 Feb 06 |
nicklas |
341 |
int definedCode = key.getItemType().getDefinedPermissions() == null ? 0 : PermissionUtil.getPermissionCode(key.getItemType().getDefinedPermissions()); |
477 |
27 Apr 05 |
nicklas |
342 |
String name = key.getItemType().name(); |
477 |
27 Apr 05 |
nicklas |
343 |
%> |
598 |
16 May 05 |
nicklas |
344 |
<input type="hidden" name="<%=name%>" value="<%=permissionCode%>"> |
598 |
16 May 05 |
nicklas |
345 |
<input type="hidden" name="<%=name%>_defined" value="<%=definedCode%>"> |
477 |
27 Apr 05 |
nicklas |
346 |
<% |
477 |
27 Apr 05 |
nicklas |
347 |
} |
477 |
27 Apr 05 |
nicklas |
348 |
%> |
465 |
26 Apr 05 |
nicklas |
349 |
</form> |
5921 |
10 Jan 12 |
nicklas |
350 |
|
5921 |
10 Jan 12 |
nicklas |
351 |
<div class="legend"> |
5946 |
03 Feb 12 |
nicklas |
352 |
<base:icon image="required.png" />= required information |
5921 |
10 Jan 12 |
nicklas |
353 |
</div> |
5921 |
10 Jan 12 |
nicklas |
354 |
|
5921 |
10 Jan 12 |
nicklas |
355 |
<base:buttongroup subclass="dialogbuttons"> |
6224 |
15 Jan 13 |
nicklas |
356 |
<base:button id="btnSave" title="Save" /> |
6224 |
15 Jan 13 |
nicklas |
357 |
<base:button id="close" title="Cancel" /> |
5921 |
10 Jan 12 |
nicklas |
358 |
</base:buttongroup> |
5921 |
10 Jan 12 |
nicklas |
359 |
|
465 |
26 Apr 05 |
nicklas |
360 |
</base:body> |
465 |
26 Apr 05 |
nicklas |
361 |
</base:page> |
465 |
26 Apr 05 |
nicklas |
362 |
<% |
465 |
26 Apr 05 |
nicklas |
363 |
} |
465 |
26 Apr 05 |
nicklas |
364 |
finally |
465 |
26 Apr 05 |
nicklas |
365 |
{ |
465 |
26 Apr 05 |
nicklas |
366 |
if (dc != null) dc.close(); |
465 |
26 Apr 05 |
nicklas |
367 |
} |
465 |
26 Apr 05 |
nicklas |
368 |
%> |