[gatein-issues] [JBoss JIRA] Commented: (GTNPORTAL-2103) Can't delete an user with Oracle database

kien nguyen (JIRA) jira-events at lists.jboss.org
Thu Sep 22 23:49:26 EDT 2011


    [ https://issues.jboss.org/browse/GTNPORTAL-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630120#comment-12630120 ] 

kien nguyen commented on GTNPORTAL-2103:
----------------------------------------

I find a problem when we remove a user, please see code in UserDAOImpl.java
{code}
 public User removeUser(String userName, boolean broadcast) throws Exception
   {
     ...

      try
      {
         // Remove all memberships and profile first
         orgService.getMembershipHandler().removeMembershipByUser(userName, false);
         orgService.getUserProfileHandler().removeUserProfile(userName, false);
      }
      catch (Exception e)
      {
         log.info("Cannot cleanup user relationships: " + userName + "; ", e);

      }

      ...

      if (broadcast)
      {
         preDelete(exoUser);
      }

      try
      {
         session.getPersistenceManager().removeUser(foundUser, true);
      }
      catch (IdentityException e)
      {
         log.info("Cannot remove user: " + userName + "; ", e);

      }

      if (broadcast)
      {
         postDelete(exoUser);
      }
      return exoUser;
   }
{code}
When we remove a user, we will remove some relationships (UserProfile, Membership) of user before removing user. This seem to make sense but after that we use the Picketlink API like {code}session.getPersistenceManager().removeUser(foundUser, true); {code} In this API, it does both tasks: remove user and relationships of user. So we duplicated action in this.
Because of this duplication, Picketlink API cannot synchronize its session for removing user with database engine.
Iam not sure this is bug of picketlink or not?
But this can be used as workaround by removing our duplication code:
{code}
try
      {
         // Remove all memberships and profile first
         orgService.getMembershipHandler().removeMembershipByUser(userName, false);
         orgService.getUserProfileHandler().removeUserProfile(userName, false);
      }
      catch (Exception e)
      {
         log.info("Cannot cleanup user relationships: " + userName + "; ", e);

      }
{code}

Use only {code}removeUser{code} api from Picketlink IDM. 

> Can't delete an user with Oracle database
> -----------------------------------------
>
>                 Key: GTNPORTAL-2103
>                 URL: https://issues.jboss.org/browse/GTNPORTAL-2103
>             Project: GateIn Portal
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Identity integration
>    Affects Versions: 3.2.0-M01
>         Environment: oracle-xe_10.2.0.1-1.0, GateIn revision 7347
>            Reporter: kien nguyen
>         Attachments: gatein2011-09-16.log
>
>
> If an Oracle database is used, we can not delete an user with the organization portlet.
> How to reproduced:
>     * connect to root/gtn.
>     * add new user.
>     * try to delete an user (has just been created) with the organization portlet-> exception
>       See error in log file

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the gatein-issues mailing list