[Yanel-dev] Problems with new security api

Paloma Gomez paloma.gomez at wyona.com
Wed Feb 21 18:35:30 CET 2007


Hi all,

I have some problems with the new security api. I am unable to retrieve 
the groups a user belongs to: I always receive an empty array.

I have extended the tests to see what's happening:

----------------------------------------------------------------------------------------------------------
public void testGetUserGroups() throws Exception {
    String userID = "lenya";
    String groupID = "editors";
    User user = identityManager.getUserManager().getUser(userID);
    assertNotNull(user);  
     //Group group = identityManager.getGroupManager().getGroup(groupID);
     //assertTrue(group.isMember(user));
     Group[] userGroups = user.getGroups();
     assertEquals(1,userGroups.length);
     assertEquals(groupID , userGroups[0].getID());
}
---------------------------------------------------------------------------------------------------------

The test fails:
--------------------------------------------------------------------------------------
 [junit] Testcase: testGetUserGroups took 0,04 sec
 [junit]     FAILED
 [junit] expected:<1> but was:<0>
----------------------------------------------------------------------------------------

If I uncomment the lines above I get:

--------------------------------------------------------------------------------------
 [junit] Testcase: testAuthenticate1 took 0,359 sec
 [junit] Testcase: testGetUser took 0,031 sec
 [junit] Testcase: testGetUserGroups took 0,031 sec
 [junit]     FAILED
 [junit] null
---------------------------------------------------------------------------------

Since the method isMember() works for the other tests, I assume I'm 
misunderstanding something.
This test suite is supposed to use the files in repository2, right?

I have made minor changes to the wyona security package (see attached 
patch), but I think they are not related...


Any hints?

Thanks,
Paloma
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wyonaSecurity.patch
Type: text/x-patch
Size: 3530 bytes
Desc: not available
Url : http://wyona.com/pipermail/yanel-development/attachments/20070221/b5797e18/wyonaSecurity.bin


More information about the Yanel-development mailing list