[security-dev] deleting a partition

Pedro Igor Silva psilva at redhat.com
Fri Jun 14 12:10:08 EDT 2013


IMO, we should not delete u/g/r and raise an exception instead. Telling the user that a partition can not be removed because of the associated data (u/r/g). 

If he wants to remove, he must remove first all related identity data.

Btw, we were doing that before the last refactoring to the Partition API.

----- Original Message -----
From: "Bill Burke" <bburke at redhat.com>
To: security-dev at lists.jboss.org
Sent: Friday, June 14, 2013 12:38:12 PM
Subject: [security-dev] deleting a partition

I'm looking at how to delete a partition and its not that simple.  Is 
this good enough?  First I delete all Agents, users, groups, and roles. 
  Relationships should be deleted too right?

         List<AttributedType> toRemove = new ArrayList<AttributedType>();
         {
             IdentityQuery<IdentityType> query = new 
DefaultIdentityQuery(context, Agent.class, this);
             List<IdentityType> resultSet = fetchQueryResults(context, 
query);
             toRemove.addAll(resultSet);
         }
         {
             IdentityQuery<IdentityType> query = new 
DefaultIdentityQuery(context, User.class, this);
             List<IdentityType> resultSet = fetchQueryResults(context, 
query);
             toRemove.addAll(resultSet);
         }
         {
             IdentityQuery<IdentityType> query = new 
DefaultIdentityQuery(context, Group.class, this);
             List<IdentityType> resultSet = fetchQueryResults(context, 
query);
             toRemove.addAll(resultSet);
         }
         {
             IdentityQuery<IdentityType> query = new 
DefaultIdentityQuery(context, Role.class, this);
             List<IdentityType> resultSet = fetchQueryResults(context, 
query);
             toRemove.addAll(resultSet);
         }

I do this all at the IdentityStore level, after this, I delete the 
partition entry using IdentityStore specific routines.


-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
_______________________________________________
security-dev mailing list
security-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/security-dev


More information about the security-dev mailing list