Return-Path: X-Original-To: apmail-portals-jetspeed-dev-archive@www.apache.org Delivered-To: apmail-portals-jetspeed-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AC81A18FC8 for ; Fri, 15 Jan 2016 01:12:02 +0000 (UTC) Received: (qmail 70453 invoked by uid 500); 15 Jan 2016 01:12:02 -0000 Delivered-To: apmail-portals-jetspeed-dev-archive@portals.apache.org Received: (qmail 70412 invoked by uid 500); 15 Jan 2016 01:12:02 -0000 Mailing-List: contact jetspeed-dev-help@portals.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Jetspeed Developers List" Delivered-To: mailing list jetspeed-dev@portals.apache.org Received: (qmail 70401 invoked by uid 99); 15 Jan 2016 01:12:02 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Jan 2016 01:12:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 18ACA1804CD for ; Fri, 15 Jan 2016 01:12:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.446 X-Spam-Level: X-Spam-Status: No, score=0.446 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.554] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id IJJmMslWPj7E for ; Fri, 15 Jan 2016 01:12:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTP id 9CEB843F0D for ; Fri, 15 Jan 2016 01:12:00 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 1A5C6E0484 for ; Fri, 15 Jan 2016 01:12:00 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 170733A0C2F for ; Fri, 15 Jan 2016 01:12:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1724715 - /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java Date: Fri, 15 Jan 2016 01:12:00 -0000 To: jetspeed-dev@portals.apache.org From: taylor@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160115011200.170733A0C2F@svn01-us-west.apache.org> Author: taylor Date: Fri Jan 15 01:11:59 2016 New Revision: 1724715 URL: http://svn.apache.org/viewvc?rev=1724715&view=rev Log: fixing backward compatibility issue with migrating from version 2.1.3, which allowed more lenient delegated security assignments. Note this feature should be turned off by default Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java?rev=1724715&r1=1724714&r2=1724715&view=diff ============================================================================== --- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java (original) +++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java Fri Jan 15 01:11:59 2016 @@ -689,7 +689,7 @@ public class JetspeedPrincipalManagement final String requiredRole = preferences.getValue(REQUIRED_ROLE, ""); final String defaultProfile = preferences.getValue(DEFAULT_PROFILE ,""); final String defaultSubsite = preferences.getValue(DEFAULT_SUBSITE ,""); - final String templateFolder = preferences.getValue(NEW_USER_TEMPLATE_DIR, "/_user/template/"); + final String templateFolder = preferences.getValue(NEW_USER_TEMPLATE_DIR, ""); final String subsiteRoot = preferences.getValue(SUB_SITE_ROOT,""); profilingRule = defaultProfile.toString(); @@ -1593,6 +1593,7 @@ public class JetspeedPrincipalManagement protected boolean associationsFrom; protected boolean admin; + protected boolean allowDelegateRoles = false; protected boolean modificationAllowed = true; /** @@ -1657,7 +1658,8 @@ public class JetspeedPrincipalManagement this.associationType = AssociationType; associationName = AssociationType.getAssociationName(); final String assoctionName = AssociationType.getAssociationName(); - String adminRole = getServiceLocator().getPortalConfiguration().getString(PortalConfigurationConstants.ROLES_DEFAULT_ADMIN); + String adminRole = getServiceLocator().getPortalConfiguration().getString(PortalConfigurationConstants.ROLES_DEFAULT_ADMIN); + allowDelegateRoles = getServiceLocator().getPortalConfiguration().getBoolean(PortalConfigurationConstants.ALLOW_DELEGATE_ASSIGN_ROLES, false); admin = getPortletRequest().isUserInRole(adminRole); if (!admin && !principal.getType().getName().equals(JetspeedPrincipalType.USER)) { @@ -1849,7 +1851,7 @@ public class JetspeedPrincipalManagement } } } - if (names.size() > 0 && !admin) + if (names.size() > 0 && !admin && !allowDelegateRoles) { // restrict creating new associations to only those the user itself belongs to String jptName = associationsFrom ? associationType.getToPrincipalType().getName() : associationType.getFromPrincipalType().getName(); @@ -1885,6 +1887,17 @@ public class JetspeedPrincipalManagement } } } + else if (!admin && allowDelegateRoles && associationType.getToPrincipalType().getName().equals(JetspeedPrincipalType.ROLE)) { + // never allow admin role to delegates + String adminRole = getServiceLocator().getPortalConfiguration().getString(PortalConfigurationConstants.ROLES_DEFAULT_ADMIN); + for (int index = names.size() - 1; index > -1; index--) { + JetspeedPrincipal listPrincipal = (JetspeedPrincipal) names.get(index); + if (listPrincipal.getName().equals(adminRole)) { + names.remove(index); + break; + } + } + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org For additional commands, e-mail: jetspeed-dev-help@portals.apache.org