Buggy code:
public class AttributeGroup extends org . tigris . scarab . om . BaseAttributeGroup implements Persistent { private static final String GET_ATTRIBUTES = "getAttributes" ; private static final String GET_R_ATTRIBUTE_ATTRGROUP = "getRAttributeAttributeGroup" ; private static final String GET_ATTRIBUTE_GROUPS = "getAttributeGroups" ; public boolean isGlobal ( ) throws TorqueException { } public ScarabModule getScarabModule ( ) { } public void setScarabModule ( ScarabModule module ) { } public void setModule ( Module me ) throws TorqueException { } public Module getModule ( ) throws TorqueException { } public List getAttributes ( ) throws Exception { } public int getHighestOrderedAttribute ( ) throws Exception { } public RAttributeAttributeGroup getRAttributeAttributeGroup ( Attribute attribute ) throws Exception { } public void delete ( ScarabUser user ) throws Exception { Module module = getModule ( ) ; <START_BUG> if ( user . hasPermission ( MODULE__EDIT , module ) ) { <END_BUG> IssueType issueType = IssueTypeManager . getInstance ( getIssueTypeId ( ) , false ) ; if ( issueType . getLocked ( ) ) { throw new ScarabException ( ( "You<seq2seq4repair_space>cannot<seq2seq4repair_space>delete<seq2seq4repair_space>this<seq2seq4repair_space>group,<seq2seq4repair_space>" + "because<seq2seq4repair_space>this<seq2seq4repair_space>issue<seq2seq4repair_space>type<seq2seq4repair_space>is<seq2seq4repair_space>locked." ) ) ; } else { List attrGroups = null ; if ( isGlobal ( ) ) { attrGroups = issueType . getAttributeGroups ( false ) ; Criteria crit = new Criteria ( ) . addJoin ( ATTRIBUTE_ID , RAttributeAttributeGroupPeer . ATTRIBUTE_ID ) . add ( GROUP_ID , getAttributeGroupId ( ) ) ; List results = RIssueTypeAttributePeer . doSelect ( crit ) ; for ( int i = 0 ; i < ( results . size ( ) ) ; i ++ ) { RIssueTypeAttribute ria = ( ( RIssueTypeAttribute ) ( results . get ( i ) ) ) ; ria . delete ( user ) ; } } else { attrGroups = module . getAttributeGroups ( getIssueType ( ) , false ) ; Criteria crit = new Criteria ( ) . addJoin ( RModuleAttributePeer . ATTRIBUTE_ID , RAttributeAttributeGroupPeer . ATTRIBUTE_ID ) . add ( GROUP_ID , getAttributeGroupId ( ) ) . add ( MODULE_ID , getModuleId ( ) ) ; Criteria . Criterion critIssueType = crit . getNewCriterion ( ISSUE_TYPE_ID , getIssueTypeId ( ) , EQUAL ) ; critIssueType . or ( crit . getNewCriterion ( ISSUE_TYPE_ID , issueType . getTemplateId ( ) , EQUAL ) ) ; crit . and ( critIssueType ) ; List results = RModuleAttributePeer . doSelect ( crit ) ; for ( int i = 0 ; i < ( results . size ( ) ) ; i ++ ) { RModuleAttribute rma = ( ( RModuleAttribute ) ( results . get ( i ) ) ) ; rma . delete ( user ) ; } } Criteria crit2 = new Criteria ( ) . add ( GROUP_ID , getAttributeGroupId ( ) ) ; RAttributeAttributeGroupPeer . doDelete ( crit2 ) ; int order = getOrder ( ) ; crit2 = new Criteria ( ) . add ( ATTRIBUTE_GROUP_ID , getAttributeGroupId ( ) ) ; AttributeGroupPeer . doDelete ( crit2 ) ; for ( int i = 0 ; i < ( attrGroups . size ( ) ) ; i ++ ) { AttributeGroup tempGroup = ( ( AttributeGroup ) ( attrGroups . get ( i ) ) ) ; int tempOrder = tempGroup . getOrder ( ) ; if ( ( tempGroup . getOrder ( ) ) > order ) { tempGroup . setOrder ( ( tempOrder - 1 ) ) ; tempGroup . save ( ) ; } } attrGroups . remove ( this ) ; ScarabCache . clear ( ) ; } } else { throw new ScarabException ( ScarabConstants . NO_PERMISSION_MESSAGE ) ; } } public void addAttribute ( Attribute attribute ) throws Exception { } public void deleteAttribute ( Attribute attribute , ScarabUser user ) throws Exception { } private RAttributeAttributeGroup addRAttributeAttributeGroup ( Attribute attribute ) throws Exception { } public AttributeGroup copyGroup ( ) throws Exception { } }

Fix:
if ( user . hasPermission ( MODULE__CONFIGURE , module ) ) {