<% | |
/* | |
* Licensed to the Apache Software Foundation (ASF) under one or more | |
* contributor license agreements. See the NOTICE file distributed with | |
* this work for additional information regarding copyright ownership. | |
* The ASF licenses this file to You under the Apache License, Version 2.0 | |
* (the "License"); you may not use this file except in compliance with | |
* the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
var privilegesInfo = sling.getService(Packages.org.apache.sling.jackrabbit.usermanager.AuthorizablePrivilegesInfo); | |
var rb = request.getResourceBundle("org.apache.sling.usermgr.Resources", null); | |
%> | |
<ul id="sidebar-nav" class="ui-corner-br"> | |
<li> | |
<a href="<%=request.contextPath%>/system/userManager.html"><%=rb.getString("menu.link.authorizables")%></a> | |
</li> | |
<li> | |
<a style="margin-left: 15px;" href="<%=request.contextPath%>/system/userManager/user.html"><%=rb.getString("menu.link.users")%></a> | |
</li> | |
<li> | |
<a style="margin-left: 15px;" href="<%=request.contextPath%>/system/userManager/group.html"><%=rb.getString("menu.link.groups")%></a> | |
</li> | |
<li> </li> | |
<% if (privilegesInfo.canAddUser(currentSession)) { %> | |
<li> | |
<a href="<%=request.contextPath%>/system/userManager/user.create.html"><%=rb.getString("menu.link.createUser")%></a> | |
</li> | |
<% } %> | |
<% if (privilegesInfo.canAddGroup(currentSession)) { %> | |
<li> | |
<a href="<%=request.contextPath%>/system/userManager/group.create.html"><%=rb.getString("menu.link.createGroup")%></a> | |
</li> | |
<% } %> | |
<% | |
var res = request.getResourceResolver().resolve(resource.path); | |
var authorizable = resource.adaptTo(Packages.org.apache.jackrabbit.api.security.user.Authorizable); | |
var canEdit = false; | |
if (authorizable) { | |
canEdit = privilegesInfo.canUpdateProperties(currentSession, authorizable.getID()); | |
} | |
if (res.resourceType == "sling/user") { %> | |
<li> | |
<a href="<%=request.contextPath%><%=resource.path%>.html"><%=rb.getString(canEdit ? "menu.link.updateUser" : "menu.link.viewUser")%></a> | |
</li> | |
<% } %> | |
<% if (res.resourceType == "sling/group") { %> | |
<li> | |
<a href="<%=request.contextPath%><%=resource.path%>.html"><%=rb.getString(canEdit ? "menu.link.updateGroup" : "menu.link.viewGroup")%></a> | |
</li> | |
<% } %> | |
</ul> |