http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/roleReportlet2csv.xsl ---------------------------------------------------------------------- diff --git a/core/logic/src/main/resources/report/roleReportlet2csv.xsl b/core/logic/src/main/resources/report/roleReportlet2csv.xsl deleted file mode 100644 index ad092d5..0000000 --- a/core/logic/src/main/resources/report/roleReportlet2csv.xsl +++ /dev/null @@ -1,118 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -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. ---> - -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - version="1.0"> - - <xsl:variable name="delimiter" select="';'"/> - - <xsl:template match="reportlet[@class='org.apache.syncope.core.report.RoleReportlet']"> - - <xsl:call-template name="header"> - <xsl:with-param name="node" select="configurations/roleAttributes"/> - </xsl:call-template> - <xsl:for-each select="role"> - <xsl:call-template name="roleAttributes"> - <xsl:with-param name="header" select="../configurations/roleAttributes"/> - <xsl:with-param name="attrs" select="."/> - </xsl:call-template> - <xsl:text> </xsl:text> - </xsl:for-each> - </xsl:template> - - <xsl:template name="header"> - <xsl:param name="node"/> - <xsl:for-each select="$node/*"> - <xsl:value-of select="text()"/> - <xsl:if test="position() != last()"> - <xsl:value-of select="$delimiter"/> - </xsl:if> - </xsl:for-each> - <xsl:text> </xsl:text> - </xsl:template> - - <xsl:template name="roleAttributes"> - <xsl:param name="header"/> - <xsl:param name="attrs"/> - - <xsl:for-each select="$header/*"> - <xsl:variable name="nameAttr" select="text()"/> - - <xsl:choose> - <xsl:when test="string-length($attrs/@*[name()=$nameAttr]) > 0"> - <xsl:variable name="roleAttr" select="$attrs/@*[name()=$nameAttr]"/> - <xsl:text>"</xsl:text> - <xsl:value-of select="$roleAttr/."/> - <xsl:text>"</xsl:text> - </xsl:when> - <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='entitlement']) - and count($attrs/*[name(.)=$nameAttr]/node()) > 0"> - <xsl:text>"</xsl:text> - <xsl:for-each select="$attrs/*/entitlement"> - <xsl:variable name="value" select="@id"/> - <xsl:value-of select="$value"/> - <xsl:if test="position() != last()"> - <xsl:value-of select="$delimiter"/> - </xsl:if> - </xsl:for-each> - <xsl:text>"</xsl:text> - </xsl:when> - <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='resource']) - and count($attrs/*[name(.)=$nameAttr]/node()) > 0"> - <xsl:text>"</xsl:text> - <xsl:for-each select="$attrs/*/resource"> - <xsl:variable name="value" select="@name"/> - <xsl:value-of select="$value"/> - <xsl:if test="position() != last()"> - <xsl:value-of select="$delimiter"/> - </xsl:if> - </xsl:for-each> - <xsl:text>"</xsl:text> - </xsl:when> - <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='user']) - and count($attrs/*[name(.)=$nameAttr]/node()) > 0"> - <xsl:text>"</xsl:text> - <xsl:for-each select="$attrs/*/user"> - <xsl:variable name="value" select="@userUsername"/> - <xsl:value-of select="$value"/> - <xsl:if test="position() != last()"> - <xsl:value-of select="$delimiter"/> - </xsl:if> - </xsl:for-each> - <xsl:text>"</xsl:text> - </xsl:when> - <xsl:otherwise> - <xsl:text>"</xsl:text> - <xsl:if test="string-length($attrs/*/*[@name=$nameAttr]/value/text()) > 0"> - <xsl:variable name="value" select="$attrs/*/*[@name=$nameAttr]/value/text()"/> - <xsl:value-of select="$value"/> - </xsl:if> - <xsl:text>"</xsl:text> - </xsl:otherwise> - </xsl:choose> - <xsl:if test="position() != last()"> - <xsl:value-of select="$delimiter"/> - </xsl:if> - - </xsl:for-each> - </xsl:template> - -</xsl:stylesheet> -
http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/roleReportlet2fo.xsl ---------------------------------------------------------------------- diff --git a/core/logic/src/main/resources/report/roleReportlet2fo.xsl b/core/logic/src/main/resources/report/roleReportlet2fo.xsl deleted file mode 100644 index bb319a4..0000000 --- a/core/logic/src/main/resources/report/roleReportlet2fo.xsl +++ /dev/null @@ -1,228 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -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. ---> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:fo="http://www.w3.org/1999/XSL/Format" - version="1.0"> - - <xsl:template match="reportlet[@class='org.apache.syncope.core.report.RoleReportlet']"> - - <fo:block font-size="16pt" font-weight="bold" space-after="0.5cm" space-before="5mm">Reportlet: <xsl:value-of select="@name"/></fo:block> - - <xsl:for-each select="role"> - <fo:block font-size="14pt" font-weight="bold" space-before="15mm" space-after="5mm" background-color="(#8888ff)">Role <xsl:value-of select="@name"/></fo:block> - <fo:table table-layout="fixed" space-after="7mm"> - <fo:table-column/> - <fo:table-column/> - <fo:table-body> - <fo:table-row background-color="(#ccccff)"> - <fo:table-cell> - <fo:block>Id:</fo:block> - </fo:table-cell> - <fo:table-cell> - <fo:block font-style="italic"> - <xsl:value-of select="@id"/> - </fo:block> - </fo:table-cell> - </fo:table-row> - <xsl:if test="@roleOwner != 'null'"> - <fo:table-row background-color="(#ccccff)"> - <fo:table-cell> - <fo:block>Role Owner:</fo:block> - </fo:table-cell> - <fo:table-cell> - <fo:block font-style="italic"> - <xsl:value-of select="@roleOwner"/> - </fo:block> - </fo:table-cell> - </fo:table-row> - </xsl:if> - <xsl:if test="@userOwner != 'null'"> - <fo:table-row background-color="(#ccccff)"> - <fo:table-cell> - <fo:block>Last Login Date:</fo:block> - </fo:table-cell> - <fo:table-cell> - <fo:block font-style="italic"> - <xsl:value-of select="@userOwner"/> - </fo:block> - </fo:table-cell> - </fo:table-row> - </xsl:if> - </fo:table-body> - </fo:table> - <xsl:choose> - <xsl:when test="string-length(attributes/attribute) > 0"> - <xsl:call-template name="attributes"> - <xsl:with-param name="label">Attributes</xsl:with-param> - <xsl:with-param name="node" select="attributes/attribute"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY ATTRIBUTE</fo:block> - </xsl:otherwise> - </xsl:choose> - - <xsl:choose> - <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0"> - <xsl:call-template name="attributes"> - <xsl:with-param name="label">Derived Attributes</xsl:with-param> - <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY DERIVED ATTRIBUTE</fo:block> - </xsl:otherwise> - </xsl:choose> - <xsl:choose> - <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0"> - <xsl:call-template name="attributes"> - <xsl:with-param name="label">Virtual Attributes</xsl:with-param> - <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY VIRTUAL ATTRIBUTE</fo:block> - </xsl:otherwise> - </xsl:choose> - - <!--entitlements--> - <xsl:choose> - <xsl:when test="entitlements/entitlement"> - <xsl:call-template name="entitlements"> - <xsl:with-param name="label">Entitlements</xsl:with-param> - <xsl:with-param name="node" select="entitlements/entitlement"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY ENTITLEMENT</fo:block> - </xsl:otherwise> - </xsl:choose> - - <xsl:choose> - <xsl:when test="users/user"> - <fo:block font-size="11pt" font-weight="bold">Users</fo:block> - <xsl:for-each select="users/user"> - <fo:block background-color="(#ccccff)" font-size="9pt" font-weight="bold" space-before="4mm">User: <xsl:value-of select="@userUsername"/> (Id: <xsl:value-of select="@userId"/>)</fo:block> - - </xsl:for-each> - </xsl:when> - <xsl:otherwise> - <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY USER ASSIGNED TO</fo:block> - </xsl:otherwise> - </xsl:choose> - <xsl:call-template name="roleResources"> - <xsl:with-param name="node" select="resources/resource"/> - </xsl:call-template> - </xsl:for-each> - - </xsl:template> - - <xsl:template name="attributes"> - <xsl:param name="label"/> - <xsl:param name="node"/> - <fo:block font-size="11pt" font-weight="bold" space-after="2mm"> - <xsl:value-of select="$label"/> - </fo:block> - <fo:table table-layout="fixed" space-after="7mm"> - <fo:table-column/> - <fo:table-column/> - <fo:table-header> - <fo:table-row height="7mm" background-color="(#ccccba)"> - <fo:table-cell> - <fo:block font-weight="bold">Schema name</fo:block> - </fo:table-cell> - <fo:table-cell> - <fo:block font-weight="bold">Value(s)</fo:block> - </fo:table-cell> - </fo:table-row> - </fo:table-header> - <fo:table-body> - <xsl:for-each select="$node"> - <xsl:if test="string-length(value/text()) > 0"> - <fo:table-row height="4mm" background-color="(#ccccff)"> - <fo:table-cell> - <fo:block> - <xsl:value-of select="@name"/> - </fo:block> - </fo:table-cell> - <fo:table-cell> - <xsl:for-each select="value"> - <fo:block></fo:block><!-- <fo:block>•</fo:block>--> - <fo:block font-style="italic"> - <xsl:value-of select="text()"/> - </fo:block> - </xsl:for-each> - </fo:table-cell> - </fo:table-row> - </xsl:if> - <fo:table-row> - <fo:table-cell> - <fo:block></fo:block> - </fo:table-cell> - <fo:table-cell> - <fo:block></fo:block> - </fo:table-cell> - </fo:table-row> - </xsl:for-each> - </fo:table-body> - </fo:table> - </xsl:template> - <!--entitlements template--> - <xsl:template name="entitlements"> - <xsl:param name="label"/> - <xsl:param name="node"/> - <fo:block font-size="11pt" font-weight="bold" space-after="2mm" space-before="5mm"> - <xsl:value-of select="$label"/> - </fo:block> - <fo:table table-layout="fixed" space-after="7mm"> - <fo:table-column/> - <!--<fo:table-column/>--> - <fo:table-header> - <fo:table-row height="7mm" background-color="(#ccccba)"> - <fo:table-cell> - <fo:block font-weight="bold">Name</fo:block> - </fo:table-cell> - </fo:table-row> - </fo:table-header> - <fo:table-body> - <xsl:for-each select="$node"> - <fo:table-row height="4mm" background-color="(#ccccff)"> - <fo:table-cell> - <fo:block> - <xsl:value-of select="@id"/> - </fo:block> - </fo:table-cell> - </fo:table-row> - </xsl:for-each> - </fo:table-body> - </fo:table> - </xsl:template> - - <xsl:template name="roleResources"> - <xsl:param name="node"/> - <fo:block font-size="11pt" font-weight="bold" space-after="3mm" space-before="5mm">Role Resources</fo:block> - <xsl:for-each select="$node"> - <fo:block></fo:block> <!-- <fo:block>•</fo:block>--> - <fo:block background-color="(#ccccff)"> - <xsl:value-of select="@name"/> - </fo:block> - </xsl:for-each> - </xsl:template> -</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/roleReportlet2html.xsl ---------------------------------------------------------------------- diff --git a/core/logic/src/main/resources/report/roleReportlet2html.xsl b/core/logic/src/main/resources/report/roleReportlet2html.xsl deleted file mode 100644 index 9f5825f..0000000 --- a/core/logic/src/main/resources/report/roleReportlet2html.xsl +++ /dev/null @@ -1,196 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -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. ---> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - version="1.0"> - - <xsl:template match="reportlet[@class='org.apache.syncope.core.report.RoleReportlet']"> - <h2>Reportlet: <xsl:value-of select="@name"/></h2> - <xsl:for-each select="role"> - <h3>Role <xsl:value-of select="@name"/></h3> - - <table style="border: 1px solid black;"> - <tr> - <td>Id:</td> - <td> - <xsl:value-of select="@id"/> - </td> - </tr> - <xsl:if test="@roleOwner != 'null'"> <!--!= null test="not(USER/FIRSTNAME)" --> - <tr> - <td>Role Owner:</td> - <td> - <xsl:value-of select="@roleOwner"/> - </td> - </tr> - </xsl:if> - <xsl:if test="@userOwner != 'null'"> - <tr> - <td>User Owner:</td> - <td> - <xsl:value-of select="@userOwner"/> - </td> - </tr> - </xsl:if> - - </table> - - <xsl:choose> - <xsl:when test="string-length(attributes/attribute) > 0"> - <xsl:call-template name="attributes"> - <xsl:with-param name="label">Attributes</xsl:with-param> - <xsl:with-param name="node" select="attributes/attribute"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <h5>THIS ROLE HASN'T ANY ATTRIBUTE</h5> - </xsl:otherwise> - </xsl:choose> - - <xsl:choose> - <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0"> - <xsl:call-template name="attributes"> - <xsl:with-param name="label">Derived Attributes</xsl:with-param> - <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <h5>THIS ROLE HASN'T ANY DERIVED ATTRIBUTE</h5> - </xsl:otherwise> - </xsl:choose> - <!--</xsl:if>--> - <xsl:choose> - <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0"> - <xsl:call-template name="attributes"> - <xsl:with-param name="label">Virtual Attributes</xsl:with-param> - <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <h5>THIS ROLE HASN'T ANY VIRTUAL ATTRIBUTE</h5> - </xsl:otherwise> - </xsl:choose> - - <xsl:choose> - <xsl:when test="entitlements/entitlement"> - <xsl:call-template name="entitlements"> - <xsl:with-param name="label">Entitlements: </xsl:with-param> - <xsl:with-param name="node" select="entitlements/entitlement"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <h5>THIS ROLE HASN'T ANY ENTITLEMENT</h5> - </xsl:otherwise> - </xsl:choose> - - <xsl:choose> - <xsl:when test="users/user"> - <h4>Users</h4> - <xsl:for-each select="users/user"> - <h5>User: <xsl:value-of select="@userUsername"/> (Id: <xsl:value-of select="@userId"/>)</h5> - </xsl:for-each> - </xsl:when> - <xsl:otherwise> - <h5>THIS ROLE HASN'T ANY USER ASSIGNED TO</h5> - </xsl:otherwise> - </xsl:choose> - - <xsl:call-template name="roleResources"> - <xsl:with-param name="node" select="resources/resource"/> - </xsl:call-template> - <hr/> - - </xsl:for-each> - </xsl:template> - - <!--entitlement template--> - <xsl:template name="entitlements"> - <xsl:param name="label"/> - <xsl:param name="node"/> - - <h4> - <xsl:value-of select="$label"/> - </h4> - - <table> - - <tbody> - <xsl:for-each select="$node"> - <tr> - <td> - <xsl:value-of select="@id"/> - </td> - </tr> - </xsl:for-each> - </tbody> - </table> - </xsl:template> - - - <xsl:template name="attributes"> - <xsl:param name="label"/> - <xsl:param name="node"/> - - <h4> - <xsl:value-of select="$label"/> - </h4> - - <table> - <thead> - <tr> - <th>Schema name</th> - <th>Value(s)</th> - </tr> - </thead> - <tbody> - <xsl:for-each select="$node"> - <xsl:if test="string-length(value/text()) > 0"> - <tr> - <td> - <xsl:value-of select="@name"/> - </td> - <td> - <ul> - <xsl:for-each select="value"> - <li> - <xsl:value-of select="text()"/> - </li> - </xsl:for-each> - </ul> - </td> - </tr> - </xsl:if> - </xsl:for-each> - </tbody> - </table> - </xsl:template> - - <xsl:template name="roleResources"> - <xsl:param name="node"/> - - <h4>Role Resources</h4> - <ul> - <xsl:for-each select="$node"> - <li> - <xsl:value-of select="@name"/> - </li> - </xsl:for-each> - </ul> - </xsl:template> -</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/userReportlet2csv.xsl ---------------------------------------------------------------------- diff --git a/core/logic/src/main/resources/report/userReportlet2csv.xsl b/core/logic/src/main/resources/report/userReportlet2csv.xsl index 87c670f..8fd9f51 100644 --- a/core/logic/src/main/resources/report/userReportlet2csv.xsl +++ b/core/logic/src/main/resources/report/userReportlet2csv.xsl @@ -83,9 +83,9 @@ under the License. <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='membership']) and count($attrs/*[name(.)=$nameAttr]/node()) > 0"> <xsl:text>"</xsl:text> - <xsl:variable name="value" select="@roleName"/> + <xsl:variable name="value" select="@groupName"/> <xsl:for-each select="$attrs/*/membership"> - <xsl:variable name="value" select="@roleName"/> + <xsl:variable name="value" select="@groupName"/> <xsl:value-of select="$value"/> <xsl:if test="position() != last()"> <xsl:value-of select="$delimiter"/> @@ -116,4 +116,4 @@ under the License. </xsl:for-each> </xsl:template> -</xsl:stylesheet> \ No newline at end of file +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/userReportlet2fo.xsl ---------------------------------------------------------------------- diff --git a/core/logic/src/main/resources/report/userReportlet2fo.xsl b/core/logic/src/main/resources/report/userReportlet2fo.xsl index 977ef4c..222229d 100644 --- a/core/logic/src/main/resources/report/userReportlet2fo.xsl +++ b/core/logic/src/main/resources/report/userReportlet2fo.xsl @@ -133,7 +133,7 @@ under the License. <xsl:when test="string-length(memberships/membership) > 0"> <fo:block font-size="11pt" font-weight="bold">Memberships</fo:block> <xsl:for-each select="memberships/membership"> - <fo:block font-size="10pt" font-weight="bold" space-before="2mm">Role: <xsl:value-of select="@roleName"/>(<xsl:value-of select="@roleId"/>)</fo:block> + <fo:block font-size="10pt" font-weight="bold" space-before="2mm">Group: <xsl:value-of select="@groupName"/>(<xsl:value-of select="@groupId"/>)</fo:block> <fo:block start-indent="1cm" space-before="3mm" space-after="0.5cm"> <xsl:choose> <xsl:when test="string-length(attributes/attribute) > 0"> @@ -143,7 +143,7 @@ under the License. </xsl:call-template> </xsl:when> <xsl:otherwise> - <fo:block color="red" font-size="8pt" space-after="2mm">THIS ROLE HASN'T ANY ATTRIBUTE</fo:block> + <fo:block color="red" font-size="8pt" space-after="2mm">THIS GROUP HASN'T ANY ATTRIBUTE</fo:block> </xsl:otherwise> </xsl:choose> <xsl:choose> @@ -154,7 +154,7 @@ under the License. </xsl:call-template> </xsl:when> <xsl:otherwise> - <fo:block color="red" font-size="8pt" space-after="2mm">THIS ROLE HASN'T ANY DERIVED ATTRIBUTE</fo:block> + <fo:block color="red" font-size="8pt" space-after="2mm">THIS GROUP HASN'T ANY DERIVED ATTRIBUTE</fo:block> </xsl:otherwise> </xsl:choose> <xsl:choose> @@ -165,18 +165,18 @@ under the License. </xsl:call-template> </xsl:when> <xsl:otherwise> - <fo:block color="red" font-size="8pt" space-after="2mm">THIS ROLE HASN'T ANY VIRTUAL ATTRIBUTE</fo:block> + <fo:block color="red" font-size="8pt" space-after="2mm">THIS GROUP HASN'T ANY VIRTUAL ATTRIBUTE</fo:block> </xsl:otherwise> </xsl:choose> - <!-- 'roleResources" is defined in roleReportlet2fo.xsl --> - <xsl:call-template name="roleResources"> + <!-- 'groupResources" is defined in groupReportlet2fo.xsl --> + <xsl:call-template name="groupResources"> <xsl:with-param name="node" select="resources/resource"/> </xsl:call-template> </fo:block> </xsl:for-each> </xsl:when> <xsl:otherwise> - <fo:block color="red" font-size="9pt" space-after="3mm">THIS USER HASN'T BEEN ASSIGNED TO ANY ROLE</fo:block> + <fo:block color="red" font-size="9pt" space-after="3mm">THIS USER HASN'T BEEN ASSIGNED TO ANY GROUP</fo:block> </xsl:otherwise> </xsl:choose> <xsl:call-template name="resources"> @@ -244,4 +244,4 @@ under the License. </fo:block> </xsl:for-each> </xsl:template> -</xsl:stylesheet> \ No newline at end of file +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/main/resources/report/userReportlet2html.xsl ---------------------------------------------------------------------- diff --git a/core/logic/src/main/resources/report/userReportlet2html.xsl b/core/logic/src/main/resources/report/userReportlet2html.xsl index 751cb4c..0a0e5c5 100644 --- a/core/logic/src/main/resources/report/userReportlet2html.xsl +++ b/core/logic/src/main/resources/report/userReportlet2html.xsl @@ -110,7 +110,7 @@ under the License. <xsl:when test="string-length(memberships/membership) > 0"> <h4>Memberships</h4> <xsl:for-each select="memberships/membership"> - <h5>Role: <xsl:value-of select="@roleName"/>(<xsl:value-of select="@roleId"/>)</h5> + <h5>Group: <xsl:value-of select="@groupName"/>(<xsl:value-of select="@groupId"/>)</h5> <blockquote> <xsl:choose> <xsl:when test="string-length(attributes/attribute) > 0"> @@ -120,7 +120,7 @@ under the License. </xsl:call-template> </xsl:when> <xsl:otherwise> - <h5>THIS ROLE HASN'T ATTRIBUTES</h5> + <h5>THIS GROUP HASN'T ATTRIBUTES</h5> </xsl:otherwise> </xsl:choose> <xsl:choose> @@ -131,7 +131,7 @@ under the License. </xsl:call-template> </xsl:when> <xsl:otherwise> - <h5>THIS ROLE HASN'T DERIVED ATTRIBUTES</h5> + <h5>THIS GROUP HASN'T DERIVED ATTRIBUTES</h5> </xsl:otherwise> </xsl:choose> <xsl:choose> @@ -142,18 +142,18 @@ under the License. </xsl:call-template> </xsl:when> <xsl:otherwise> - <h5>THIS ROLE HASN'T VIRTUAL ATTRIBUTES</h5> + <h5>THIS GROUP HASN'T VIRTUAL ATTRIBUTES</h5> </xsl:otherwise> </xsl:choose> - <!-- 'roleResources" is defined in roleReportlet2html.xsl --> - <xsl:call-template name="roleResources"> + <!-- 'groupResources" is defined in groupReportlet2html.xsl --> + <xsl:call-template name="groupResources"> <xsl:with-param name="node" select="resources/resource"/> </xsl:call-template> </blockquote> </xsl:for-each> </xsl:when> <xsl:otherwise> - <h5>THIS USER ISN'T ASSIGNED TO A ROLE</h5> + <h5>THIS USER ISN'T ASSIGNED TO A GROUP</h5> </xsl:otherwise> </xsl:choose> <xsl:if test="string-length(resources) > 0"> @@ -216,4 +216,4 @@ under the License. </xsl:for-each> </ul> </xsl:template> -</xsl:stylesheet> \ No newline at end of file +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java ---------------------------------------------------------------------- diff --git a/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java b/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java index 39b79ce..fdf4d11 100644 --- a/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java +++ b/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java @@ -39,12 +39,12 @@ import javax.mail.Session; import javax.mail.Store; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.common.lib.SyncopeConstants; -import org.apache.syncope.common.lib.search.RoleFiqlSearchConditionBuilder; +import org.apache.syncope.common.lib.search.GroupFiqlSearchConditionBuilder; import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder; import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.lib.to.MembershipTO; import org.apache.syncope.common.lib.to.NotificationTaskTO; -import org.apache.syncope.common.lib.to.RoleTO; +import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.AttributableType; import org.apache.syncope.common.lib.types.IntMappingType; @@ -137,7 +137,7 @@ public class NotificationTest { private UserLogic userLogic; @Autowired - private RoleLogic roleLogic; + private GroupLogic groupLogic; @Autowired private TaskLogic taskLogic; @@ -257,8 +257,8 @@ public class NotificationTest { // 1. create suitable notification for subsequent tests Notification notification = entityFactory.newEntity(Notification.class); notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); - notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query()); - notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query()); + notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query()); notification.setSelfAsRecipient(true); notification.setRecipientAttrName("email"); @@ -279,7 +279,7 @@ public class NotificationTest { // 2. create user UserTO userTO = getSampleTO(MAIL_ADDRESS); MembershipTO membershipTO = new MembershipTO(); - membershipTO.setRoleId(7); + membershipTO.setGroupId(7); userTO.getMemberships().add(membershipTO); userLogic.create(userTO, true); @@ -315,8 +315,8 @@ public class NotificationTest { // 1. create suitable notification for subsequent tests Notification notification = entityFactory.newEntity(Notification.class); notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); - notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query()); - notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query()); + notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query()); notification.setSelfAsRecipient(true); notification.setRecipientAttrName("email"); @@ -336,7 +336,7 @@ public class NotificationTest { // 2. create user UserTO userTO = getSampleTO(MAIL_ADDRESS); MembershipTO membershipTO = new MembershipTO(); - membershipTO.setRoleId(7); + membershipTO.setGroupId(7); userTO.getMemberships().add(membershipTO); userLogic.create(userTO, true); @@ -368,7 +368,7 @@ public class NotificationTest { Notification notification = entityFactory.newEntity(Notification.class); notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); notification.setUserAbout(null); - notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query()); notification.setSelfAsRecipient(true); notification.setRecipientAttrName("email"); @@ -389,7 +389,7 @@ public class NotificationTest { // 2. create user UserTO userTO = getSampleTO(MAIL_ADDRESS); MembershipTO membershipTO = new MembershipTO(); - membershipTO.setRoleId(7); + membershipTO.setGroupId(7); userTO.getMemberships().add(membershipTO); userLogic.create(userTO, true); @@ -418,7 +418,7 @@ public class NotificationTest { Notification notification = entityFactory.newEntity(Notification.class); notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); notification.setUserAbout(null); - notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query()); notification.setSelfAsRecipient(true); notification.setRecipientAttrName("email"); @@ -439,7 +439,7 @@ public class NotificationTest { // 2. create user UserTO userTO = getSampleTO(MAIL_ADDRESS); MembershipTO membershipTO = new MembershipTO(); - membershipTO.setRoleId(7); + membershipTO.setGroupId(7); userTO.getMemberships().add(membershipTO); userLogic.create(userTO, true); @@ -486,8 +486,8 @@ public class NotificationTest { // 1. create suitable notification for subsequent tests Notification notification = entityFactory.newEntity(Notification.class); notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); - notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query()); - notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query()); + notification.setRecipients(new UserFiqlSearchConditionBuilder().inGroups(8L).query()); notification.setSelfAsRecipient(true); notification.setRecipientAttrName("email"); @@ -510,7 +510,7 @@ public class NotificationTest { // 2. create user UserTO userTO = getSampleTO(MAIL_ADDRESS); MembershipTO membershipTO = new MembershipTO(); - membershipTO.setRoleId(7); + membershipTO.setGroupId(7); userTO.getMemberships().add(membershipTO); userLogic.create(userTO, true); @@ -545,7 +545,7 @@ public class NotificationTest { // 1. create suitable disabled notification for subsequent tests Notification notification = entityFactory.newEntity(Notification.class); notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); - notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query()); + notification.setUserAbout(new UserFiqlSearchConditionBuilder().inGroups(7L).query()); notification.setSelfAsRecipient(true); notification.setRecipientAttrName("email"); @@ -571,7 +571,7 @@ public class NotificationTest { // 2. create user UserTO userTO = getUniqueSampleTO(MAIL_ADDRESS); MembershipTO membershipTO = new MembershipTO(); - membershipTO.setRoleId(7); + membershipTO.setGroupId(7); userTO.getMemberships().add(membershipTO); userLogic.create(userTO, true); @@ -588,8 +588,8 @@ public class NotificationTest { // 1. create suitable notification for subsequent tests Notification notification = entityFactory.newEntity(Notification.class); - notification.addEvent("[REST]:[RoleLogic]:[]:[create]:[SUCCESS]"); - notification.setRoleAbout(new RoleFiqlSearchConditionBuilder().is("name").equalTo("role446").query()); + notification.addEvent("[REST]:[GroupLogic]:[]:[create]:[SUCCESS]"); + notification.setGroupAbout(new GroupFiqlSearchConditionBuilder().is("name").equalTo("group446").query()); notification.setSelfAsRecipient(false); notification.setRecipientAttrName("email"); @@ -609,13 +609,13 @@ public class NotificationTest { notificationDAO.flush(); - // 2. create role - RoleTO roleTO = new RoleTO(); - roleTO.setName("role446"); - roleTO.setParent(1L); + // 2. create group + GroupTO groupTO = new GroupTO(); + groupTO.setName("group446"); + groupTO.setParent(1L); - RoleTO createdRole = roleLogic.create(roleTO); - assertNotNull(createdRole); + GroupTO createdGroup = groupLogic.create(groupTO); + assertNotNull(createdGroup); // 3. force Quartz job execution and verify e-mail notificationJob.execute(null); http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java b/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java index 474b96d..8590aee 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/AuditManager.java @@ -52,30 +52,30 @@ public class AuditManager { final Object output, final Object... input) { - final Throwable throwable; - final StringBuilder message = new StringBuilder(); + final StringBuilder message = new StringBuilder(32); - message.append("BEFORE:\n"); - message.append("\t").append(before == null ? "unknown" : before).append("\n"); + message.append("BEFORE:\n"). + append('\t').append(before == null ? "unknown" : before).append('\n'); message.append("INPUT:\n"); if (ArrayUtils.isNotEmpty(input)) { for (Object obj : input) { - message.append("\t").append(obj == null ? null : obj.toString()).append("\n"); + message.append('\t').append(obj == null ? null : obj.toString()).append('\n'); } } else { - message.append("\t").append("none").append("\n"); + message.append('\t').append("none").append('\n'); } message.append("OUTPUT:\n"); + Throwable throwable; if (output instanceof Throwable) { throwable = (Throwable) output; - message.append("\t").append(throwable.getMessage()); + message.append('\t').append(throwable.getMessage()); } else { throwable = null; - message.append("\t").append(output == null ? "none" : output.toString()); + message.append('\t').append(output == null ? "none" : output.toString()); } AuditLoggerName auditLoggerName = null; @@ -93,7 +93,7 @@ public class AuditManager { final SecurityContext ctx = SecurityContextHolder.getContext(); if (ctx != null && ctx.getAuthentication() != null) { - auditMessage.append('[').append(ctx.getAuthentication().getName()).append(']').append(' '); + auditMessage.append('[').append(ctx.getAuthentication().getName()).append("] "); } auditMessage.append(message); http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java index adb1637..182e2c7 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/ConnObjectUtil.java @@ -37,7 +37,7 @@ import org.apache.syncope.common.lib.to.AbstractSubjectTO; import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.lib.to.ConnObjectTO; import org.apache.syncope.common.lib.to.MembershipTO; -import org.apache.syncope.common.lib.to.RoleTO; +import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.types.AttrSchemaType; import org.apache.syncope.common.lib.types.AttributableType; @@ -46,10 +46,9 @@ import org.apache.syncope.common.lib.types.MappingPurpose; import org.apache.syncope.common.lib.types.PasswordPolicySpec; import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException; import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO; -import org.apache.syncope.core.persistence.api.dao.NotFoundException; import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO; import org.apache.syncope.core.persistence.api.dao.PolicyDAO; -import org.apache.syncope.core.persistence.api.dao.RoleDAO; +import org.apache.syncope.core.persistence.api.dao.GroupDAO; import org.apache.syncope.core.persistence.api.dao.UserDAO; import org.apache.syncope.core.persistence.api.entity.Attributable; import org.apache.syncope.core.persistence.api.entity.AttributableUtil; @@ -61,7 +60,7 @@ import org.apache.syncope.core.persistence.api.entity.PlainSchema; import org.apache.syncope.core.persistence.api.entity.Subject; import org.apache.syncope.core.persistence.api.entity.VirAttr; import org.apache.syncope.core.persistence.api.entity.membership.Membership; -import org.apache.syncope.core.persistence.api.entity.role.Role; +import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.task.SyncTask; import org.apache.syncope.core.persistence.api.entity.user.User; import org.apache.syncope.core.provisioning.api.Connector; @@ -69,7 +68,6 @@ import org.apache.syncope.core.provisioning.api.ConnectorFactory; import org.apache.syncope.core.provisioning.api.cache.VirAttrCache; import org.apache.syncope.core.provisioning.api.cache.VirAttrCacheValue; import org.apache.syncope.core.misc.security.Encryptor; -import org.apache.syncope.core.misc.security.UnauthorizedRoleException; import org.apache.syncope.core.misc.spring.ApplicationContextProvider; import org.apache.syncope.core.misc.jexl.JexlUtil; import org.identityconnectors.common.Base64; @@ -102,7 +100,7 @@ public class ConnObjectUtil { private UserDAO userDAO; @Autowired - private RoleDAO roleDAO; + private GroupDAO groupDAO; @Autowired private ExternalResourceDAO resourceDAO; @@ -130,7 +128,7 @@ public class ConnObjectUtil { if (subject instanceof User) { result = ObjectClass.ACCOUNT; } - if (subject instanceof Role) { + if (subject instanceof Group) { result = ObjectClass.GROUP; } @@ -138,12 +136,12 @@ public class ConnObjectUtil { } /** - * Build a UserTO / RoleTO out of connector object attributes and schema mapping. + * Build a UserTO / GroupTO out of connector object attributes and schema mapping. * * @param obj connector object * @param syncTask synchronization task * @param attrUtil AttributableUtil - * @param <T> user/role + * @param <T> user/group * @return UserTO for the user to be created */ @Transactional(readOnly = true) @@ -164,11 +162,11 @@ public class ConnObjectUtil { } for (MembershipTO memb : userTO.getMemberships()) { - Role role = roleDAO.find(memb.getRoleId()); - if (role != null && role.getPasswordPolicy() != null - && role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) { + Group group = groupDAO.find(memb.getGroupId()); + if (group != null && group.getPasswordPolicy() != null + && group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) { - ppSpecs.add(role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class)); + ppSpecs.add(group.getPasswordPolicy().getSpecification(PasswordPolicySpec.class)); } } @@ -203,16 +201,13 @@ public class ConnObjectUtil { * @param original subject to get diff from * @param syncTask synchronization task * @param attrUtil AttributableUtil - * @param <T> user/role - * @return modifications for the user/role to be updated - * @throws NotFoundException if given id does not correspond to a T instance - * @throws UnauthorizedRoleException if there are no enough entitlements to access the T instance + * @param <T> user/group + * @return modifications for the user/group to be updated */ @SuppressWarnings("unchecked") @Transactional(readOnly = true) public <T extends AbstractAttributableMod> T getAttributableMod(final Long key, final ConnectorObject obj, - final AbstractAttributableTO original, final SyncTask syncTask, final AttributableUtil attrUtil) - throws NotFoundException, UnauthorizedRoleException { + final AbstractAttributableTO original, final SyncTask syncTask, final AttributableUtil attrUtil) { final AbstractAttributableTO updated = getSubjectTOFromConnObject(obj, syncTask, attrUtil); updated.setKey(key); @@ -228,7 +223,7 @@ public class ConnObjectUtil { } for (MembershipTO membTO : ((UserTO) updated).getMemberships()) { - Membership memb = user.getMembership(membTO.getRoleId()); + Membership memb = user.getMembership(membTO.getGroupId()); if (memb != null) { membTO.setKey(memb.getKey()); } @@ -236,10 +231,10 @@ public class ConnObjectUtil { return (T) AttributableOperations.diff(((UserTO) updated), ((UserTO) original), true); } - if (AttributableType.ROLE == attrUtil.getType()) { + if (AttributableType.GROUP == attrUtil.getType()) { // reading from connector object cannot change entitlements - ((RoleTO) updated).getEntitlements().addAll(((RoleTO) original).getEntitlements()); - return (T) AttributableOperations.diff(((RoleTO) updated), ((RoleTO) original), true); + ((GroupTO) updated).getEntitlements().addAll(((GroupTO) original).getEntitlements()); + return (T) AttributableOperations.diff(((GroupTO) updated), ((GroupTO) original), true); } return null; @@ -259,7 +254,7 @@ public class ConnObjectUtil { AttrTO attributeTO; switch (item.getIntMappingType()) { case UserId: - case RoleId: + case GroupId: break; case Password: @@ -279,19 +274,19 @@ public class ConnObjectUtil { } break; - case RoleName: - if (subjectTO instanceof RoleTO) { - ((RoleTO) subjectTO).setName(attribute == null || attribute.getValue().isEmpty() + case GroupName: + if (subjectTO instanceof GroupTO) { + ((GroupTO) subjectTO).setName(attribute == null || attribute.getValue().isEmpty() || attribute.getValue().get(0) == null ? null : attribute.getValue().get(0).toString()); } break; - case RoleOwnerSchema: - if (subjectTO instanceof RoleTO && attribute != null) { + case GroupOwnerSchema: + if (subjectTO instanceof GroupTO && attribute != null) { // using a special attribute (with schema "", that will be ignored) for carrying the - // RoleOwnerSchema value + // GroupOwnerSchema value attributeTO = new AttrTO(); attributeTO.setSchema(StringUtils.EMPTY); if (attribute.getValue().isEmpty() || attribute.getValue().get(0) == null) { @@ -300,12 +295,12 @@ public class ConnObjectUtil { attributeTO.getValues().add(attribute.getValue().get(0).toString()); } - ((RoleTO) subjectTO).getPlainAttrs().add(attributeTO); + ((GroupTO) subjectTO).getPlainAttrs().add(attributeTO); } break; case UserPlainSchema: - case RolePlainSchema: + case GroupPlainSchema: attributeTO = new AttrTO(); attributeTO.setSchema(item.getIntAttrName()); @@ -335,6 +330,7 @@ public class ConnObjectUtil { attrValue.setStringValue(value.toString()); schemaType = AttrSchemaType.String; } + break; } attributeTO.getValues().add(attrValue.getValueAsString(schemaType)); } @@ -344,14 +340,14 @@ public class ConnObjectUtil { break; case UserDerivedSchema: - case RoleDerivedSchema: + case GroupDerivedSchema: attributeTO = new AttrTO(); attributeTO.setSchema(item.getIntAttrName()); subjectTO.getDerAttrs().add(attributeTO); break; case UserVirtualSchema: - case RoleVirtualSchema: + case GroupVirtualSchema: attributeTO = new AttrTO(); attributeTO.setSchema(item.getIntAttrName()); @@ -373,7 +369,7 @@ public class ConnObjectUtil { // 2. add data from defined template (if any) AbstractSubjectTO template = AttributableType.USER == attrUtil.getType() - ? syncTask.getUserTemplate() : syncTask.getRoleTemplate(); + ? syncTask.getUserTemplate() : syncTask.getGroupTemplate(); if (template != null) { if (template instanceof UserTO) { @@ -394,63 +390,63 @@ public class ConnObjectUtil { Map<Long, MembershipTO> currentMembs = ((UserTO) subjectTO).getMembershipMap(); for (MembershipTO membTO : ((UserTO) template).getMemberships()) { MembershipTO membTBU; - if (currentMembs.containsKey(membTO.getRoleId())) { - membTBU = currentMembs.get(membTO.getRoleId()); + if (currentMembs.containsKey(membTO.getGroupId())) { + membTBU = currentMembs.get(membTO.getGroupId()); } else { membTBU = new MembershipTO(); - membTBU.setRoleId(membTO.getRoleId()); + membTBU.setGroupId(membTO.getGroupId()); ((UserTO) subjectTO).getMemberships().add(membTBU); } fillFromTemplate(membTBU, membTO); } } - if (template instanceof RoleTO) { - if (StringUtils.isNotBlank(((RoleTO) template).getName())) { - String evaluated = JexlUtil.evaluate(((RoleTO) template).getName(), subjectTO); + if (template instanceof GroupTO) { + if (StringUtils.isNotBlank(((GroupTO) template).getName())) { + String evaluated = JexlUtil.evaluate(((GroupTO) template).getName(), subjectTO); if (StringUtils.isNotBlank(evaluated)) { - ((RoleTO) subjectTO).setName(evaluated); + ((GroupTO) subjectTO).setName(evaluated); } } - if (((RoleTO) template).getParent() != 0) { - final Role parentRole = roleDAO.find(((RoleTO) template).getParent()); - if (parentRole != null) { - ((RoleTO) subjectTO).setParent(parentRole.getKey()); + if (((GroupTO) template).getParent() != 0) { + final Group parentGroup = groupDAO.find(((GroupTO) template).getParent()); + if (parentGroup != null) { + ((GroupTO) subjectTO).setParent(parentGroup.getKey()); } } - if (((RoleTO) template).getUserOwner() != null) { - final User userOwner = userDAO.find(((RoleTO) template).getUserOwner()); + if (((GroupTO) template).getUserOwner() != null) { + final User userOwner = userDAO.find(((GroupTO) template).getUserOwner()); if (userOwner != null) { - ((RoleTO) subjectTO).setUserOwner(userOwner.getKey()); + ((GroupTO) subjectTO).setUserOwner(userOwner.getKey()); } } - if (((RoleTO) template).getRoleOwner() != null) { - final Role roleOwner = roleDAO.find(((RoleTO) template).getRoleOwner()); - if (roleOwner != null) { - ((RoleTO) subjectTO).setRoleOwner(roleOwner.getKey()); + if (((GroupTO) template).getGroupOwner() != null) { + final Group groupOwner = groupDAO.find(((GroupTO) template).getGroupOwner()); + if (groupOwner != null) { + ((GroupTO) subjectTO).setGroupOwner(groupOwner.getKey()); } } - ((RoleTO) subjectTO).getEntitlements().addAll(((RoleTO) template).getEntitlements()); - - ((RoleTO) subjectTO).getRPlainAttrTemplates().addAll(((RoleTO) template).getRPlainAttrTemplates()); - ((RoleTO) subjectTO).getRDerAttrTemplates().addAll(((RoleTO) template).getRDerAttrTemplates()); - ((RoleTO) subjectTO).getRVirAttrTemplates().addAll(((RoleTO) template).getRVirAttrTemplates()); - ((RoleTO) subjectTO).getMPlainAttrTemplates().addAll(((RoleTO) template).getMPlainAttrTemplates()); - ((RoleTO) subjectTO).getMDerAttrTemplates().addAll(((RoleTO) template).getMDerAttrTemplates()); - ((RoleTO) subjectTO).getMVirAttrTemplates().addAll(((RoleTO) template).getMVirAttrTemplates()); - - ((RoleTO) subjectTO).setAccountPolicy(((RoleTO) template).getAccountPolicy()); - ((RoleTO) subjectTO).setPasswordPolicy(((RoleTO) template).getPasswordPolicy()); - - ((RoleTO) subjectTO).setInheritOwner(((RoleTO) template).isInheritOwner()); - ((RoleTO) subjectTO).setInheritTemplates(((RoleTO) template).isInheritTemplates()); - ((RoleTO) subjectTO).setInheritPlainAttrs(((RoleTO) template).isInheritPlainAttrs()); - ((RoleTO) subjectTO).setInheritDerAttrs(((RoleTO) template).isInheritDerAttrs()); - ((RoleTO) subjectTO).setInheritVirAttrs(((RoleTO) template).isInheritVirAttrs()); - ((RoleTO) subjectTO).setInheritPasswordPolicy(((RoleTO) template).isInheritPasswordPolicy()); - ((RoleTO) subjectTO).setInheritAccountPolicy(((RoleTO) template).isInheritAccountPolicy()); + ((GroupTO) subjectTO).getEntitlements().addAll(((GroupTO) template).getEntitlements()); + + ((GroupTO) subjectTO).getGPlainAttrTemplates().addAll(((GroupTO) template).getGPlainAttrTemplates()); + ((GroupTO) subjectTO).getGDerAttrTemplates().addAll(((GroupTO) template).getGDerAttrTemplates()); + ((GroupTO) subjectTO).getGVirAttrTemplates().addAll(((GroupTO) template).getGVirAttrTemplates()); + ((GroupTO) subjectTO).getMPlainAttrTemplates().addAll(((GroupTO) template).getMPlainAttrTemplates()); + ((GroupTO) subjectTO).getMDerAttrTemplates().addAll(((GroupTO) template).getMDerAttrTemplates()); + ((GroupTO) subjectTO).getMVirAttrTemplates().addAll(((GroupTO) template).getMVirAttrTemplates()); + + ((GroupTO) subjectTO).setAccountPolicy(((GroupTO) template).getAccountPolicy()); + ((GroupTO) subjectTO).setPasswordPolicy(((GroupTO) template).getPasswordPolicy()); + + ((GroupTO) subjectTO).setInheritOwner(((GroupTO) template).isInheritOwner()); + ((GroupTO) subjectTO).setInheritTemplates(((GroupTO) template).isInheritTemplates()); + ((GroupTO) subjectTO).setInheritPlainAttrs(((GroupTO) template).isInheritPlainAttrs()); + ((GroupTO) subjectTO).setInheritDerAttrs(((GroupTO) template).isInheritDerAttrs()); + ((GroupTO) subjectTO).setInheritVirAttrs(((GroupTO) template).isInheritVirAttrs()); + ((GroupTO) subjectTO).setInheritPasswordPolicy(((GroupTO) template).isInheritPasswordPolicy()); + ((GroupTO) subjectTO).setInheritAccountPolicy(((GroupTO) template).isInheritAccountPolicy()); } fillFromTemplate(subjectTO, template); @@ -533,7 +529,7 @@ public class ConnObjectUtil { /** * Query connected external resources for values to populated virtual attributes associated with the given owner. * - * @param owner user or role + * @param owner user or group * @param attrUtil attributable util */ public void retrieveVirAttrValues(final Attributable<?, ?, ?> owner, final AttributableUtil attrUtil) { @@ -541,8 +537,8 @@ public class ConnObjectUtil { final ConnectorFactory connFactory = context.getBean(ConnectorFactory.class); final IntMappingType type = attrUtil.getType() == AttributableType.USER - ? IntMappingType.UserVirtualSchema : attrUtil.getType() == AttributableType.ROLE - ? IntMappingType.RoleVirtualSchema : IntMappingType.MembershipVirtualSchema; + ? IntMappingType.UserVirtualSchema : attrUtil.getType() == AttributableType.GROUP + ? IntMappingType.GroupVirtualSchema : IntMappingType.MembershipVirtualSchema; final Map<String, ConnectorObject> externalResources = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java index 267cfa0..8075650 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/MappingUtil.java @@ -55,11 +55,11 @@ import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema; import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema; import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema; import org.apache.syncope.core.persistence.api.entity.membership.Membership; -import org.apache.syncope.core.persistence.api.entity.role.RDerSchema; -import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue; -import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema; -import org.apache.syncope.core.persistence.api.entity.role.RVirSchema; -import org.apache.syncope.core.persistence.api.entity.role.Role; +import org.apache.syncope.core.persistence.api.entity.group.GDerSchema; +import org.apache.syncope.core.persistence.api.entity.group.GPlainAttrValue; +import org.apache.syncope.core.persistence.api.entity.group.GPlainSchema; +import org.apache.syncope.core.persistence.api.entity.group.GVirSchema; +import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.user.UDerSchema; import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue; import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema; @@ -133,8 +133,8 @@ public final class MappingUtil { /** * Prepare attributes for sending to a connector instance. * - * @param attrUtil user / role - * @param subject given user / role + * @param attrUtil user / group + * @param subject given user / group * @param password clear-text password * @param changePwd whether password should be included for propagation attributes or not * @param vAttrsToBeRemoved virtual attributes to be removed @@ -172,8 +172,8 @@ public final class MappingUtil { try { if ((attrUtil.getType() == AttributableType.USER && mapping.getIntMappingType() == IntMappingType.UserVirtualSchema) - || (attrUtil.getType() == AttributableType.ROLE - && mapping.getIntMappingType() == IntMappingType.RoleVirtualSchema)) { + || (attrUtil.getType() == AttributableType.GROUP + && mapping.getIntMappingType() == IntMappingType.GroupVirtualSchema)) { LOG.debug("Expire entry cache {}-{}", subject.getKey(), mapping.getIntAttrName()); virAttrCache.expire(attrUtil.getType(), subject.getKey(), mapping.getIntAttrName()); @@ -272,14 +272,14 @@ public final class MappingUtil { } break; - case ROLE: + case GROUP: if (subject instanceof User) { - for (Role role : ((User) subject).getRoles()) { - connObjectUtil.retrieveVirAttrValues(role, attrUtilFactory.getInstance(role)); - attributables.add(role); + for (Group group : ((User) subject).getGroups()) { + connObjectUtil.retrieveVirAttrValues(group, attrUtilFactory.getInstance(group)); + attributables.add(group); } } - if (subject instanceof Role) { + if (subject instanceof Group) { attributables.add(subject); } break; @@ -304,7 +304,7 @@ public final class MappingUtil { switch (mapItem.getIntMappingType()) { case UserPlainSchema: - case RolePlainSchema: + case GroupPlainSchema: case MembershipPlainSchema: final PlainSchemaDAO plainSchemaDAO = context.getBean(PlainSchemaDAO.class); schema = plainSchemaDAO.find(mapItem.getIntAttrName(), @@ -313,7 +313,7 @@ public final class MappingUtil { break; case UserVirtualSchema: - case RoleVirtualSchema: + case GroupVirtualSchema: case MembershipVirtualSchema: VirSchemaDAO virSchemaDAO = context.getBean(VirSchemaDAO.class); VirSchema virSchema = virSchemaDAO.find(mapItem.getIntAttrName(), @@ -402,7 +402,7 @@ public final class MappingUtil { * Build __NAME__ for propagation. First look if there ia a defined accountLink for the given resource (and in this * case evaluate as JEXL); otherwise, take given accountId. * - * @param subject given user / role + * @param subject given user / group * @param resource target resource * @param accountId accountId * @return the value to be propagated as __NAME__ @@ -447,7 +447,7 @@ public final class MappingUtil { return name; } - private static String getRoleOwnerValue( + private static String getGroupOwnerValue( final ExternalResource resource, final Subject<?, ?, ?> subject) { AttributableUtilFactory attrUtilFactory = @@ -459,8 +459,8 @@ public final class MappingUtil { Collections.<String>emptySet(), Collections.<String, AttrMod>emptyMap()); String accountId = preparedAttr.getKey(); - final Name roleOwnerName = evaluateNAME(subject, resource, accountId); - return roleOwnerName.getNameValue(); + final Name groupOwnerName = evaluateNAME(subject, resource, accountId); + return groupOwnerName.getNameValue(); } /** @@ -488,7 +488,7 @@ public final class MappingUtil { PlainAttrValue attrValue; switch (mappingItem.getIntMappingType()) { case UserPlainSchema: - case RolePlainSchema: + case GroupPlainSchema: case MembershipPlainSchema: for (Attributable<?, ?, ?> attributable : attributables) { final PlainAttr attr = attributable.getPlainAttr(mappingItem.getIntAttrName()); @@ -510,7 +510,7 @@ public final class MappingUtil { break; case UserVirtualSchema: - case RoleVirtualSchema: + case GroupVirtualSchema: for (Attributable<?, ?, ?> attributable : attributables) { VirAttr virAttr = attributable.getVirAttr(mappingItem.getIntAttrName()); if (virAttr != null) { @@ -579,13 +579,13 @@ public final class MappingUtil { break; case UserDerivedSchema: - case RoleDerivedSchema: + case GroupDerivedSchema: case MembershipDerivedSchema: for (Attributable<?, ?, ?> attributable : attributables) { DerAttr derAttr = attributable.getDerAttr(mappingItem.getIntAttrName()); if (derAttr != null) { - attrValue = attributable instanceof Role - ? entityFactory.newEntity(RPlainAttrValue.class) + attrValue = attributable instanceof Group + ? entityFactory.newEntity(GPlainAttrValue.class) : entityFactory.newEntity(UPlainAttrValue.class); attrValue.setStringValue(derAttr.getValue(attributable.getPlainAttrs())); values.add(attrValue); @@ -600,7 +600,7 @@ public final class MappingUtil { break; case UserId: - case RoleId: + case GroupId: case MembershipId: for (Attributable<?, ?, ?> attributable : attributables) { attrValue = entityFactory.newEntity(UPlainAttrValue.class); @@ -619,31 +619,31 @@ public final class MappingUtil { } break; - case RoleName: + case GroupName: for (Attributable<?, ?, ?> attributable : attributables) { - if (attributable instanceof Role) { - attrValue = entityFactory.newEntity(RPlainAttrValue.class); - attrValue.setStringValue(((Role) attributable).getName()); + if (attributable instanceof Group) { + attrValue = entityFactory.newEntity(GPlainAttrValue.class); + attrValue.setStringValue(((Group) attributable).getName()); values.add(attrValue); } } break; - case RoleOwnerSchema: + case GroupOwnerSchema: for (Attributable<?, ?, ?> attributable : attributables) { - if (attributable instanceof Role) { - Role role = (Role) attributable; - String roleOwnerValue = null; - if (role.getUserOwner() != null && resource.getUmapping() != null) { - roleOwnerValue = getRoleOwnerValue(resource, role.getUserOwner()); + if (attributable instanceof Group) { + Group group = (Group) attributable; + String groupOwnerValue = null; + if (group.getUserOwner() != null && resource.getUmapping() != null) { + groupOwnerValue = getGroupOwnerValue(resource, group.getUserOwner()); } - if (role.getRoleOwner() != null && resource.getRmapping() != null) { - roleOwnerValue = getRoleOwnerValue(resource, role.getRoleOwner()); + if (group.getGroupOwner() != null && resource.getGmapping() != null) { + groupOwnerValue = getGroupOwnerValue(resource, group.getGroupOwner()); } - if (StringUtils.isNotBlank(roleOwnerValue)) { - attrValue = entityFactory.newEntity(RPlainAttrValue.class); - attrValue.setStringValue(roleOwnerValue); + if (StringUtils.isNotBlank(groupOwnerValue)) { + attrValue = entityFactory.newEntity(GPlainAttrValue.class); + attrValue.setStringValue(groupOwnerValue); values.add(attrValue); } } @@ -691,8 +691,8 @@ public final class MappingUtil { result = UPlainSchema.class; break; - case RolePlainSchema: - result = RPlainSchema.class; + case GroupPlainSchema: + result = GPlainSchema.class; break; case MembershipPlainSchema: @@ -703,8 +703,8 @@ public final class MappingUtil { result = UDerSchema.class; break; - case RoleDerivedSchema: - result = RDerSchema.class; + case GroupDerivedSchema: + result = GDerSchema.class; break; case MembershipDerivedSchema: @@ -715,8 +715,8 @@ public final class MappingUtil { result = UVirSchema.class; break; - case RoleVirtualSchema: - result = RVirSchema.class; + case GroupVirtualSchema: + result = GVirSchema.class; break; case MembershipVirtualSchema: http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java index 6b21915..fe688f3 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/EmptyClassLoader.java @@ -29,7 +29,7 @@ class EmptyClassLoader extends ClassLoader { } @Override - protected Class<?> loadClass(final String name, boolean resolve) throws ClassNotFoundException { + protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException { throw new ClassNotFoundException("This classloader won't attemp to load " + name); } http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java index e060dca..b624eaa 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/JexlUtil.java @@ -48,28 +48,24 @@ import org.slf4j.LoggerFactory; */ public final class JexlUtil { - /** - * Logger. - * - */ private static final Logger LOG = LoggerFactory.getLogger(JexlUtil.class); private static final String[] IGNORE_FIELDS = { "password", "clearPassword", "serialVersionUID", "class" }; - private static JexlEngine jexlEngine; + private static JexlEngine JEXL_ENGINE; private static JexlEngine getEngine() { synchronized (LOG) { - if (jexlEngine == null) { - jexlEngine = new JexlEngine(new ClassFreeUberspectImpl(null), null, null, null); - jexlEngine.setClassLoader(new EmptyClassLoader()); - jexlEngine.setCache(512); - jexlEngine.setLenient(true); - jexlEngine.setSilent(false); + if (JEXL_ENGINE == null) { + JEXL_ENGINE = new JexlEngine(new ClassFreeUberspectImpl(null), null, null, null); + JEXL_ENGINE.setClassLoader(new EmptyClassLoader()); + JEXL_ENGINE.setCache(512); + JEXL_ENGINE.setLenient(true); + JEXL_ENGINE.setSilent(false); } } - return jexlEngine; + return JEXL_ENGINE; } public static boolean isExpressionValid(final String expression) { http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java index c924721..ab0e7fb 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/AccountPolicyEnforcer.java @@ -35,9 +35,7 @@ public class AccountPolicyEnforcer implements PolicyEnforcer<AccountPolicySpec, private UserSuspender userSuspender; @Override - public void enforce(final AccountPolicySpec policy, final PolicyType type, final User user) - throws AccountPolicyException, PolicyEnforceException { - + public void enforce(final AccountPolicySpec policy, final PolicyType type, final User user) { if (user.getUsername() == null) { throw new PolicyEnforceException("Invalid account"); } http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java index 12968c5..41a6bb6 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PasswordPolicyEnforcer.java @@ -27,9 +27,7 @@ import org.springframework.stereotype.Component; public class PasswordPolicyEnforcer implements PolicyEnforcer<PasswordPolicySpec, User> { @Override - public void enforce(final PasswordPolicySpec policy, final PolicyType type, final User user) - throws PasswordPolicyException, PolicyEnforceException { - + public void enforce(final PasswordPolicySpec policy, final PolicyType type, final User user) { final String clearPassword = user.getClearPassword(); final String password = user.getPassword(); http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java index fb9f364..c8274a4 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/policy/PolicyEnforcer.java @@ -18,13 +18,10 @@ */ package org.apache.syncope.core.misc.policy; -import java.io.InvalidObjectException; - import org.apache.syncope.common.lib.types.PolicySpec; import org.apache.syncope.common.lib.types.PolicyType; public interface PolicyEnforcer<T extends PolicySpec, E> { - void enforce(final T policy, final PolicyType type, final E object) - throws InvalidObjectException, PolicyException; + void enforce(final T policy, final PolicyType type, final E object); } http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java index dd56314..e6756ad 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondConverter.java @@ -20,7 +20,7 @@ package org.apache.syncope.core.misc.search; import org.apache.cxf.jaxrs.ext.search.SearchBean; import org.apache.cxf.jaxrs.ext.search.fiql.FiqlParser; -import org.apache.syncope.common.lib.search.SyncopeFiqlSearchConditionBuilder; +import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder; import org.apache.syncope.core.persistence.api.dao.search.SearchCond; /** @@ -37,7 +37,7 @@ public final class SearchCondConverter { */ public static SearchCond convert(final String fiqlExpression) { FiqlParser<SearchBean> fiqlParser = new FiqlParser<SearchBean>( - SearchBean.class, SyncopeFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES); + SearchBean.class, AbstractFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES); SearchCondVisitor searchCondVisitor = new SearchCondVisitor(); searchCondVisitor.visit(fiqlParser.parse(fiqlExpression)); http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java index 3e941ac..949dee7 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/search/SearchCondVisitor.java @@ -28,7 +28,7 @@ import org.apache.cxf.jaxrs.ext.search.SearchUtils; import org.apache.cxf.jaxrs.ext.search.visitor.AbstractSearchConditionVisitor; import org.apache.syncope.common.lib.search.SearchableFields; import org.apache.syncope.common.lib.search.SpecialAttr; -import org.apache.syncope.common.lib.to.RoleTO; +import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.core.persistence.api.dao.search.AttributeCond; import org.apache.syncope.core.persistence.api.dao.search.EntitlementCond; @@ -47,7 +47,7 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean static { ATTRIBUTABLE_FIELDS = new ArrayList<String>(); ATTRIBUTABLE_FIELDS.addAll(SearchableFields.get(UserTO.class)); - ATTRIBUTABLE_FIELDS.addAll(SearchableFields.get(RoleTO.class)); + ATTRIBUTABLE_FIELDS.addAll(SearchableFields.get(GroupTO.class)); } private SearchCond searchCond; @@ -96,9 +96,9 @@ public class SearchCondVisitor extends AbstractSearchConditionVisitor<SearchBean leaf = SearchCond.getLeafCond(attributeCond); } else { switch (specialAttrName) { - case ROLES: + case GROUPS: MembershipCond membershipCond = new MembershipCond(); - membershipCond.setRoleId(Long.valueOf(value)); + membershipCond.setGroupId(Long.valueOf(value)); leaf = SearchCond.getLeafCond(membershipCond); break; http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java ---------------------------------------------------------------------- diff --git a/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java index 6f91fe3..d88c353 100644 --- a/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java +++ b/core/misc/src/main/java/org/apache/syncope/core/misc/security/AuthContextUtil.java @@ -52,15 +52,15 @@ public final class AuthContextUtil { } /** - * Extend the current authentication context to include the given role. + * Extend the current authentication context to include the given group. * - * @param roleKey role key - * @param roleEntitlement role entitlement + * @param groupKey group key + * @param groupEntitlement group entitlement */ - public static void extendAuthContext(final Long roleKey, final String roleEntitlement) { + public static void extendAuthContext(final Long groupKey, final String groupEntitlement) { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); List<GrantedAuthority> authorities = new ArrayList<>(auth.getAuthorities()); - authorities.add(new SimpleGrantedAuthority(roleEntitlement)); + authorities.add(new SimpleGrantedAuthority(groupEntitlement)); Authentication newAuth = new UsernamePasswordAuthenticationToken( auth.getPrincipal(), auth.getCredentials(), authorities); SecurityContextHolder.getContext().setAuthentication(newAuth);
