pingidentity / scim2

The UnboundID SCIM 2.0 SDK for Java
175 stars 72 forks source link

Sub-attributes of group resource's member attribute should be immutable #189

Closed joachimLengacher closed 11 months ago

joachimLengacher commented 1 year ago

Describe the bug According to the RFC, the sub-attributes of the group resource's member attribute should be immutable instead of readOnly.

To Reproduce Call the /Schemas endpoint. The mutability is readOnly for all sub-attribute of the member attribute instead of immutable, see the $ref attribute, for example:

{
  "name": "$ref",
  "type": "reference",
  "multiValued": false,
  "description": "The URI of the corresponding Group resource to which the user belongs",
  "required": false,
  "caseExact": true,
  "mutability": "readOnly",
  "returned": "default",
  "uniqueness": "none",
  "referenceTypes": [
      "Group",
      "User"
  ]
}

Expected behavior The values of mutability of all the sub-attributes should be immutable.

Additional context

joachimLengacher commented 1 year ago

Here's a proposal for a fix along with a test that also highlights the requested change: https://github.com/pingidentity/scim2/pull/190

kqarryzada commented 1 year ago

Thanks for reporting this, @joachimLengacher. I'll look more into this, but at first glance, it seems appropriate to update these values on the Group class. The RFC seems clear about this.

joachimLengacher commented 1 year ago

@kqarryzada I just discovered a potential other problem: in GroupResource the multiValueClass is com.unboundid.scim2.common.types.Group where the return type is List<Member>. I guess that the multiValueClass should be com.unboundid.scim2.common.types.Member because com.unboundid.scim2.common.types.Group is also used in the UserResource:

@Attribute(description = "A list of members of the Group.",
        isRequired = false,
        mutability = AttributeDefinition.Mutability.READ_WRITE,
        returned = AttributeDefinition.Returned.DEFAULT,
        multiValueClass = Group.class)
private List<Member> members;

I will update that in my PR too...

kqarryzada commented 11 months ago

The code change for this issue has been committed to master. Thanks for reporting this.