Author: bdaw
Date: 2010-11-17 08:41:00 -0500 (Wed, 17 Nov 2010)
New Revision: 555
Modified:
idm/branches/1.1.0/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/minimal-flexible-identity-config.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-2k3.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-2k8.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-local.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends12.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends20.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapd-23.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapd-24.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapds.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-redhatds.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-sunds.xml
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config.xml
Log:
Fix issue where readOnly attribute was updated in LDAP. Make update of readOnly attribute
silently fail.
Modified:
idm/branches/1.1.0/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-hibernate/src/main/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2010-11-17
13:41:00 UTC (rev 555)
@@ -1883,7 +1883,10 @@
}
if (amd.isReadonly())
{
- throw new IdentityException("Cannot update readonly attribute: "
+ attribute.getName());
+ // Just silently fail and go on
+ mappedAttributes.remove(name);
+ continue;
+ //throw new IdentityException("Cannot update readonly attribute:
" + attribute.getName());
}
if (amd.isUnique())
@@ -2051,7 +2054,10 @@
}
if (amd.isReadonly())
{
- throw new IdentityException("Cannot add readonly attribute: " +
attribute.getName());
+ // Just silently fail and go on
+ mappedAttributes.remove(name);
+ continue;
+ //throw new IdentityException("Cannot add readonly attribute: "
+ attribute.getName());
}
if (amd.isUnique())
Modified:
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-ldap/src/main/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreImpl.java 2010-11-17
13:41:00 UTC (rev 555)
@@ -2819,14 +2819,16 @@
if (mdMap != null)
{
- IdentityObjectAttributeMetaData amd = mdMap.get(attributeName);
+ IdentityObjectAttributeMetaData amd = mdMap.get(name);
if (amd != null && !amd.isMultivalued() && values.size()
> 1)
{
throw new IdentityException("Cannot assigned multiply values to
single valued attribute: " + attributeName);
}
if (amd != null && amd.isReadonly())
{
- throw new IdentityException("Cannot update readonly attribute:
" + attributeName);
+ // Just silently fail and go on
+ continue;
+ // throw new IdentityException("Cannot update readonly attribute:
" + attributeName);
}
if (amd != null && amd.isUnique())
@@ -2960,7 +2962,9 @@
}
if (amd != null && amd.isReadonly())
{
- throw new IdentityException("Cannot update readonly attribute:
" + attributeName);
+ // Just silently fail and go on
+ continue;
+ //throw new IdentityException("Cannot update readonly attribute:
" + attributeName);
}
if (amd != null && amd.isUnique())
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java 2010-11-17
13:41:00 UTC (rev 555)
@@ -289,7 +289,19 @@
assertEquals(3, attributes.keySet().size());
assertEquals("Dawidowicz",
(attributes.get(P3PConstants.INFO_USER_NAME_FAMILY)).getValue());
+ // Check readOnly attribute change
+ userInfo = new Attribute[]
+ {
+ new SimpleAttribute("description", new String[]{"some
description"})
+ };
+ session.getAttributesManager().addAttributes(bdawidowUser, userInfo);
+ session.getAttributesManager().updateAttributes(bdawidowUser, userInfo);
+
+ attributes = session.getAttributesManager().getAttributes(bdawidowUser);
+ assertEquals(3, attributes.keySet().size());
+ assertEquals(null, (attributes.get("description")));
+
// Generate random binary data for binary attribute
Random random = new Random();
@@ -426,7 +438,7 @@
User u1 = session.getPersistenceManager().findUser("!(06_13_07 Sche)
!(0");
- assertNotNull(u1);
+ assertNotNull(u1);
ctx.commit();
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/minimal-flexible-identity-config.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/minimal-flexible-identity-config.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/minimal-flexible-identity-config.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -41,7 +41,24 @@
<relationship-type>JBOSS_IDENTITY_MEMBERSHIP</relationship-type>
<relationship-type>JBOSS_IDENTITY_ROLE</relationship-type>
</supported-relationship-types>
- <supported-identity-object-types/>
+ <supported-identity-object-types>
+ <identity-object-type>
+ <name>USER</name>
+ <relationships/>
+ <credentials/>
+ <attributes>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
+ </attributes>
+ <options/>
+ </identity-object-type>
+ </supported-identity-object-types>
<options>
<option>
<name>hibernateSessionFactoryJNDIName</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-2k3.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-2k3.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-2k3.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -172,6 +172,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -476,7 +484,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-2k8.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-2k8.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-2k8.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -172,6 +172,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -476,7 +484,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-local.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-local.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-local.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -200,6 +200,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -504,7 +512,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends12.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends12.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends12.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -211,6 +211,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -515,7 +523,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends20.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends20.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends20.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -211,6 +211,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -523,7 +531,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>email</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapd-23.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapd-23.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapd-23.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -172,6 +172,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -476,7 +484,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapd-24.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapd-24.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapd-24.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -172,6 +172,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -476,7 +484,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapds.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapds.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapds.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -172,6 +172,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -476,7 +484,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-redhatds.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-redhatds.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-redhatds.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -200,6 +200,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -504,7 +512,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-sunds.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-sunds.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config-sunds.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -200,6 +200,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -504,7 +512,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>
Modified:
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config.xml
===================================================================
---
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config.xml 2010-11-16
20:57:31 UTC (rev 554)
+++
idm/branches/1.1.0/picketlink-idm-testsuite/src/test/resources/test-identity-config.xml 2010-11-17
13:41:00 UTC (rev 555)
@@ -245,6 +245,14 @@
<isReadOnly>false</isReadOnly>
<isUnique>true</isUnique>
</attribute>
+ <attribute>
+ <name>description</name>
+ <mapping>description</mapping>
+ <type>text</type>
+ <isRequired>false</isRequired>
+ <isMultivalued>false</isMultivalued>
+ <isReadOnly>true</isReadOnly>
+ </attribute>
</attributes>
<options/>
</identity-object-type>
@@ -549,7 +557,7 @@
<type>text</type>
<isRequired>false</isRequired>
<isMultivalued>false</isMultivalued>
- <isReadOnly>false</isReadOnly>
+ <isReadOnly>true</isReadOnly>
</attribute>
<attribute>
<name>carLicense</name>