Hi Colm, please find my comments inline.
Il giorno 15/mar/2012, alle ore 20.56, Colm O hEigeartaigh ha scritto:
> Hi all,
>
> I've been playing around with using a (CXF) REST client with Syncope.
> I have a number of queries mainly revolving around Ids.:
>
> 1) Most of the REST API's for Users seem to focus on User Id's rather
> than Usernames. One exception is where you can read a user by either
> Id or username. However I can only delete a user by Id and not
> username. Should the UserController be modified to also accept a
> username for delete?
I think so. Username is mandatory and unique so it could be used in place of id.
Probably this kind of improvement should be done before the next official
release.
I suggest to open a new issue on for this.
> 2) When creating a new user, you must specify any roles the user is a
> member of via the Role Id rather than the Role name. Again, should
> this be changed so that either works? It seems reasonable to me to be
> able to only specify the role name as the user might not know the role
> Id without having to perform another query. Similarly, MembershipMod
> only takes the Role Id and not the Role Name, if you want to update
> the role of a user.
Colm, you are right but role name has been designed to be unique at the same
hierarchy level only.
Probably we should discuss about the advantages to have a not unique role name
among the entire hierarchy.
> 3) It does not seem to be possible to specify a User Id when creating
> a new user - any value I set via UserMod.setId gets ignored. Is this
> expected behaviour or a bug?
This is an expected behavior. IDs are generated automatically by sequence
tables.
> 4) Is it possible to update a user's attributes or membership
> information without also changing the password? I'm running into
> exceptions when I try to do this - maybe I'm messing something up
> though.
You should be able to modify user's attributes without specifying any new
password.
Can you provide more information in order to reproduce your case?
> 5) AbstractAttributableMod has no method to add a new (non
> derived/virtual) attribute - only a method to update it. Is this an
> oversight? The method naming is not consistent here - should it be
> possible to add/remove/update both attributes, derived, and virtual
> attributes?
You can add a derived attribute using methods addDerivedAttributeToBeAddedd.
You can remove a derived attribute by using the method
addDerivedAttributeToBeRemoved.
In case of normal and virtual attributes you can replace attributes in two
steps:
1. add attribute to be removed
2. add attribute to be updated.
For example if you want to change the userId attribute you can do:
userMod.addAttributeToBeRemoved("userId");
attributeMod = new AttributeMod();
attributeMod.setSchema("userId");
attributeMod.addValueToBeAdded("[email protected]");
userMod.addAttributeToBeUpdated(attributeMod);
Regards,
F.