All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.user.roles.jsp Maven / Gradle / Ivy

There is a newer version: 3.0.6
Show newest version
<%--
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
--%>

<%@ include file="/init.jsp" %>

<%
User selUser = (User)request.getAttribute("user.selUser");
List groups = (List)request.getAttribute("user.groups");
List organizations = (List)request.getAttribute("user.organizations");
Long[] organizationIds = UsersAdminUtil.getOrganizationIds(organizations);
List roles = (List)request.getAttribute("user.roles");
List organizationRoles = (List)request.getAttribute("user.organizationRoles");
List siteRoles = (List)request.getAttribute("user.siteRoles");
List inheritedSiteRoles = (List)request.getAttribute("user.inheritedSiteRoles");
List roleGroups = (List)request.getAttribute("user.roleGroups");

currentURLObj.setParameter("historyKey", renderResponse.getNamespace() + "roles");

String regularRoleSyncEntitiesEventName = liferayPortletResponse.getNamespace() + "syncRegularRoles";
String siteRoleSyncEntitiesEventName = liferayPortletResponse.getNamespace() + "syncSiteRoles";
String organizationRoleSyncEntitiesEventName = liferayPortletResponse.getNamespace() + "syncOrganizationRoles";
%>






	










	

	
		
			
		

		
			
				<%= removeRoleIcon %>
			
		
	

	



	

	
		AUI.$('#selectRegularRoleLink').on(
			'click',
			function(event) {
				Liferay.Util.selectEntity(
					{
						dialog: {
							constrain: true,
							modal: true
						},

						<%
						String regularRoleEventName = liferayPortletResponse.getNamespace() + "selectRegularRole";
						%>

						id: '<%= regularRoleEventName %>',
						title: '',

						<%
						PortletURL selectRegularRoleURL = PortletProviderUtil.getPortletURL(request, Role.class.getName(), PortletProvider.Action.BROWSE);

						selectRegularRoleURL.setParameter("p_u_i_d", (selUser == null) ? "0" : String.valueOf(selUser.getUserId()));
						selectRegularRoleURL.setParameter("eventName", regularRoleEventName);
						selectRegularRoleURL.setParameter("syncEntitiesEventName", regularRoleSyncEntitiesEventName);
						selectRegularRoleURL.setWindowState(LiferayWindowState.POP_UP);
						%>

						uri: '<%= selectRegularRoleURL.toString() %>'
					},
					function(event) {
						selectRole(event.roleid, event.roletitle, event.searchcontainername, event.groupdescriptivename, event.groupid, event.iconcssclass);
					}
				);
			}
		);
	


<% List groupRoles = RoleLocalServiceUtil.getGroupRoles(group.getGroupId()); %>

<% boolean membershipProtected = false; Group group = userGroupRole.getGroup(); Role role = userGroupRole.getRole(); if (role.getType() == RoleConstants.TYPE_ORGANIZATION) { membershipProtected = OrganizationMembershipPolicyUtil.isMembershipProtected(permissionChecker, userGroupRole.getUserId(), group.getOrganizationId()); } else { membershipProtected = SiteMembershipPolicyUtil.isMembershipProtected(permissionChecker, userGroupRole.getUserId(), group.getGroupId()); } %> <%= removeRoleIcon %> var Util = Liferay.Util; var searchContainer = Liferay.SearchContainer.get('organizationRolesSearchContainer'); var searchContainerContentBox = searchContainer.get('contentBox'); searchContainerContentBox.delegate( 'click', function(event) { var link = event.currentTarget; var tr = link.ancestor('tr'); var groupId = link.getAttribute('data-groupId'); var rowId = link.getAttribute('data-rowId'); var selectOrganizationRole = Util.getWindow('selectOrganizationRole'); if (selectOrganizationRole) { var selectButton = selectOrganizationRole.iframe.node.get('contentWindow.document').one('.selector-button[data-groupid="' + groupId + '"][data-roleid="' + rowId + '"]'); Util.toggleDisabled(selectButton, false); } searchContainer.deleteRow(tr, rowId); deleteGroupRole(rowId, groupId); }, '.modify-link' ); Liferay.on( '<%= organizationRoleSyncEntitiesEventName %>', function(event) { event.selectors.each( function(item, index, collection) { var groupId = item.attr('data-groupid'); var roleId = item.attr('data-roleid'); for (var i = 0; i < deleteGroupRolesGroupIds.length; i++) { if ((deleteGroupRolesGroupIds[i] == groupId) && (deleteGroupRolesRoleIds[i] == roleId)) { Util.toggleDisabled(item, false); break; } } } ); } ); AUI.$('#selectOrganizationRoleLink').on( 'click', function(event) { Liferay.Util.selectEntity( { dialog: { constrain: true, modal: true }, <% String organizationRoleEventName = liferayPortletResponse.getNamespace() + "selectOrganizationRole"; %> id: '<%= organizationRoleEventName %>', title: '', <% PortletURL selectOrganizationRoleURL = PortletProviderUtil.getPortletURL(request, Role.class.getName(), PortletProvider.Action.BROWSE); selectOrganizationRoleURL.setParameter("p_u_i_d", (selUser == null) ? "0" : String.valueOf(selUser.getUserId())); selectOrganizationRoleURL.setParameter("step", "1"); selectOrganizationRoleURL.setParameter("roleType", String.valueOf(RoleConstants.TYPE_ORGANIZATION)); selectOrganizationRoleURL.setParameter("organizationIds", StringUtil.merge(organizationIds)); selectOrganizationRoleURL.setParameter("eventName", organizationRoleEventName); selectOrganizationRoleURL.setParameter("syncEntitiesEventName", organizationRoleSyncEntitiesEventName); selectOrganizationRoleURL.setWindowState(LiferayWindowState.POP_UP); %> uri: '<%= selectOrganizationRoleURL.toString() %>' }, function(event) { selectRole(event.roleid, event.roletitle, event.searchcontainername, event.groupdescriptivename, event.groupid, event.iconcssclass); } ); } );

<% boolean membershipProtected = false; Group group = userGroupRole.getGroup(); Role role = userGroupRole.getRole(); if (role.getType() == RoleConstants.TYPE_ORGANIZATION) { membershipProtected = OrganizationMembershipPolicyUtil.isMembershipProtected(permissionChecker, userGroupRole.getUserId(), group.getOrganizationId()); } else { membershipProtected = SiteMembershipPolicyUtil.isMembershipProtected(permissionChecker, userGroupRole.getUserId(), group.getGroupId()); } %> <%= removeRoleIcon %> var Util = Liferay.Util; var searchContainer = Liferay.SearchContainer.get('siteRolesSearchContainer'); var searchContainerContentBox = searchContainer.get('contentBox'); searchContainerContentBox.delegate( 'click', function(event) { var link = event.currentTarget; var tr = link.ancestor('tr'); var groupId = link.getAttribute('data-groupId'); var rowId = link.getAttribute('data-rowId'); var selectSiteRole = Util.getWindow('selectSiteRole'); if (selectSiteRole) { var selectButton = selectSiteRole.iframe.node.get('contentWindow.document').one('.selector-button[data-groupid="' + groupId + '"][data-roleid="' + rowId + '"]'); Util.toggleDisabled(selectButton, false); } searchContainer.deleteRow(tr, rowId); deleteGroupRole(rowId, groupId); }, '.modify-link' ); Liferay.on( '<%= siteRoleSyncEntitiesEventName %>', function(event) { event.selectors.each( function(item, index, collection) { var groupId = item.attr('data-groupid'); var roleId = item.attr('data-roleid'); for (var i = 0; i < deleteGroupRolesGroupIds.length; i++) { if ((deleteGroupRolesGroupIds[i] == groupId) && (deleteGroupRolesRoleIds[i] == roleId)) { Util.toggleDisabled(item, false); break; } } } ); } ); A.one('#selectSiteRoleLink').on( 'click', function(event) { Util.selectEntity( { dialog: { constrain: true, modal: true }, <% String siteRoleEventName = liferayPortletResponse.getNamespace() + "selectSiteRole"; %> id: '<%= siteRoleEventName %>', title: '', <% PortletURL selectSiteRoleURL = PortletProviderUtil.getPortletURL(request, Role.class.getName(), PortletProvider.Action.BROWSE); selectSiteRoleURL.setParameter("p_u_i_d", (selUser == null) ? "0" : String.valueOf(selUser.getUserId())); selectSiteRoleURL.setParameter("step", "1"); selectSiteRoleURL.setParameter("roleType", String.valueOf(RoleConstants.TYPE_SITE)); selectSiteRoleURL.setParameter("eventName", siteRoleEventName); selectSiteRoleURL.setParameter("syncEntitiesEventName", siteRoleSyncEntitiesEventName); selectSiteRoleURL.setWindowState(LiferayWindowState.POP_UP); %> uri: '<%= selectSiteRoleURL.toString() %>' }, function(event) { selectRole(event.roleid, event.roletitle, event.searchcontainername, event.groupdescriptivename, event.groupid, event.iconcssclass); } ); } );

var addRoleIds = []; var deleteRoleIds = []; var addGroupRolesGroupIds = []; var addGroupRolesRoleIds = []; var deleteGroupRolesGroupIds = []; var deleteGroupRolesRoleIds = []; function deleteRegularRole(roleId) { var A = AUI(); A.Array.removeItem(addRoleIds, roleId); deleteRoleIds.push(roleId); document.fm.addRoleIds.value = addRoleIds.join(','); document.fm.deleteRoleIds.value = deleteRoleIds.join(','); } function deleteGroupRole(roleId, groupId) { for (var i = 0; i < addGroupRolesRoleIds.length; i++) { if ((addGroupRolesGroupIds[i] == groupId) && (addGroupRolesRoleIds[i] == roleId)) { addGroupRolesGroupIds.splice(i, 1); addGroupRolesRoleIds.splice(i, 1); break; } } deleteGroupRolesGroupIds.push(groupId); deleteGroupRolesRoleIds.push(roleId); document.fm.addGroupRolesGroupIds.value = addGroupRolesGroupIds.join(','); document.fm.addGroupRolesRoleIds.value = addGroupRolesRoleIds.join(','); document.fm.deleteGroupRolesGroupIds.value = deleteGroupRolesGroupIds.join(','); document.fm.deleteGroupRolesRoleIds.value = deleteGroupRolesRoleIds.join(','); } Liferay.provide( window, 'selectRole', function(roleId, name, searchContainer, groupName, groupId, iconCssClass) { var A = AUI(); var LString = A.Lang.String; var searchContainerName = '' + searchContainer + 'SearchContainer'; searchContainer = Liferay.SearchContainer.get(searchContainerName); var rowColumns = []; rowColumns.push(' ' + LString.escapeHTML(name)); if (groupName) { rowColumns.push(groupName); } if (groupId) { rowColumns.push('<%= UnicodeFormatter.toString(removeRoleIcon) %>'); for (var i = 0; i < deleteGroupRolesRoleIds.length; i++) { if ((deleteGroupRolesGroupIds[i] == groupId) && (deleteGroupRolesRoleIds[i] == roleId)) { deleteGroupRolesGroupIds.splice(i, 1); deleteGroupRolesRoleIds.splice(i, 1); break; } } addGroupRolesGroupIds.push(groupId); addGroupRolesRoleIds.push(roleId); document.fm.addGroupRolesGroupIds.value = addGroupRolesGroupIds.join(','); document.fm.addGroupRolesRoleIds.value = addGroupRolesRoleIds.join(','); document.fm.deleteGroupRolesGroupIds.value = deleteGroupRolesGroupIds.join(','); document.fm.deleteGroupRolesRoleIds.value = deleteGroupRolesRoleIds.join(','); } else { rowColumns.push('<%= UnicodeFormatter.toString(removeRoleIcon) %>'); A.Array.removeItem(deleteRoleIds, roleId); addRoleIds.push(roleId); document.fm.addRoleIds.value = addRoleIds.join(','); document.fm.deleteRoleIds.value = deleteRoleIds.join(','); } searchContainer.addRow(rowColumns, roleId); searchContainer.updateDataStore(); }, ['liferay-search-container'] ); var Util = Liferay.Util; var searchContainer = Liferay.SearchContainer.get('rolesSearchContainer'); var searchContainerContentBox = searchContainer.get('contentBox'); searchContainerContentBox.delegate( 'click', function(event) { var link = event.currentTarget; var rowId = link.attr('data-rowId'); var tr = link.ancestor('tr'); var selectRegularRole = Util.getWindow('selectRegularRole'); if (selectRegularRole) { var selectButton = selectRegularRole.iframe.node.get('contentWindow.document').one('.selector-button[data-roleid="' + rowId + '"]'); Util.toggleDisabled(selectButton, false); } searchContainer.deleteRow(tr, link.getAttribute('data-rowId')); deleteRegularRole(rowId); }, '.modify-link' ); Liferay.on( '<%= regularRoleSyncEntitiesEventName %>', function(event) { event.selectors.each( function(item, index, collection) { var roleId = item.attr('data-roleid'); if (deleteRoleIds.indexOf(roleId) != -1) { Util.toggleDisabled(item, false); } } ); } );




© 2015 - 2025 Weber Informatics LLC | Privacy Policy