[Yanel-dev] Checking if an alias already exists

Michael Wechner michael.wechner at wyona.com
Fri Apr 1 11:14:53 CEST 2011


Hi Ioannis

On 3/31/11 6:27 PM, Ioannis Iordanidis wrote:
> Hi Michael,
>
> We don't seem to have a method to check if a String is already in use 
> as an alias. It seems that one can create identical aliases across 
> different user accounts.

you're right, whereas the Yarep implementation does do a check

src/impl/java/org/wyona/security/impl/yarep/YarepUserManager.java#createAlias

or rather see

http://svn.wyona.com/repos/public/security/trunk/src/impl/java/org/wyona/security/impl/yarep/YarepUserManager.java

and will throw an exception if an alias already exists.

But I agree it would be nice to have a method to catch this more 
gracefully and also
not to depend on an implementation actually checking on this.

We would have to add it to the interface, e.g.

Index: src/core/java/org/wyona/security/core/api/UserManager.java
===================================================================
--- src/core/java/org/wyona/security/core/api/UserManager.java    
(revision 56962)
+++ src/core/java/org/wyona/security/core/api/UserManager.java    
(working copy)
@@ -114,6 +114,15 @@
      boolean existsUser(String id) throws AccessManagementException;

      /**
+     * Indicates whether an alias with the given id exists.
+     *
+     * @param id ID of alias
+     * @return true if an alias with the given id exists.
+     * @throws AccessManagementException
+     */
+    boolean existsAlias(String id) throws AccessManagementException;
+
+    /**
       * Get the true ID of a user
       *
       * @param id Either pseudonym or true ID

but this will break the backwards compatibility.

Let me think about it ....
> maybe need to open a new bug for this in bugzilla?

yes, please a bug :-)

Thanks

Michael
>
> Cheers
> Giannis



More information about the Yanel-development mailing list