Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-636

need change log events for attributes and types assigned to groups when they are deleted

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • HEAD
    • 2.0.0
    • API
    • None

    Description

      There arent any change log events on group.delete() for types (and maybe attributes). Here is the cause:

      Hib3GroupDao:

      // delete attributes
      ByHql byHql = hibernateSession.byHql();
      byHql.createQuery("delete from Attribute where group_id = :group");
      byHql.setString("group", _g.getUuid() );
      byHql.executeUpdate();
      // delete type tuples
      byHql = hibernateSession.byHql();
      byHql.createQuery("delete from GroupTypeTuple where group_uuid = :group");
      byHql.setString("group", _g.getUuid() );
      byHql.executeUpdate();

      Here is a potential solution from Peter DiCamillo (though we probably just want to select the objects and call .delete() on them so they are processed normally with hooks etc:

      Index: Group.java
      ===================================================================
      — Group.java (revision 7442)
      +++ Group.java (working copy)
      @@ -1198,6 +1198,18 @@
      attributeAssign.delete();
      }

      + // generate an unassign event for each type the group has
      + Set<GroupType> groupTypes = Group.this.getTypes();
      + for (GroupType groupType : groupTypes)

      { + //change log into temp table + new ChangeLogEntry(true, ChangeLogTypeBuiltin.GROUP_TYPE_UNASSIGN, + ChangeLogLabels.GROUP_TYPE_UNASSIGN.id.name(), "", + ChangeLogLabels.GROUP_TYPE_UNASSIGN.groupId.name(), Group.this.getUuid(), + ChangeLogLabels.GROUP_TYPE_UNASSIGN.groupName.name(), Group.this.getName(), + ChangeLogLabels.GROUP_TYPE_UNASSIGN.typeId.name(), groupType.getUuid(), + ChangeLogLabels.GROUP_TYPE_UNASSIGN.typeName.name(), groupType.getName()).save(); + }

      +
      //deletes.add(this); // ... And add the group last for good luck
      String name = Group.this.getName(); // Preserve name for logging
      GrouperDAOFactory.getFactory().getGroup().delete(Group.this);

      Attachments

        Activity

          People

            tom.barton.2@at.internet2.edu Tom Barton (internet2.edu)
            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: