AnsweredAssumed Answered

candidateStarterGroups and custom user & group tables

Question asked by edwinvds on Oct 15, 2012
Latest reply on Oct 16, 2012 by edwinvds
Hi,

We have just migrated from the built in user & group tables ( act_id_user & act_id_group ) to our own set of tables. After the migration I noticed that the candidateStarterGroup functionality no longer works, which worked fine before the migration. This functionality allows you to tag the BPMN process with the activiti attribute  activiti:candidateStarterGroups , as explained here http://activiti.org/userguide/#security

Using a BPMN process element:

   
<process activiti:candidateStarterGroups="mygroup" id="myprocess" name="My Process">

And given a user named "user1", member of "mygroup" , the following code would return the expected process definition, but no longer does:

    //org.activiti.engine.RepositoryService
    repositoryService
        .createProcessDefinitionQuery()
        .startableByUser("user1")
        .list();

I've narrowed it down to the query defined in ProcessDefinition.xml , which is joining the wrong user and group tables :

      <if test="authorizationUserId != null">
        AND (exists (select ID_  from ${prefix} ACT_RU_IDENTITYLINK  IDN where IDN.PROC_DEF_ID_ = RES.ID_ and IDN.USER_ID_ = #{authorizationUserId})
             OR exists (select IDN.ID_  from ${prefix} ACT_RU_IDENTITYLINK  IDN,  ${prefix} ACT_ID_MEMBERSHIP MBMR where IDN.PROC_DEF_ID_ = RES.ID_ and MBMR.USER_ID_ =  #{authorizationUserId} and IDN.GROUP_ID_ = MBMR.GROUP_ID_)
             )
      </if>
     
So my question is twofold:
  • is this a bug or a feature ?

  • what is the best way to override the built in query, without patching Activiti ?
Thanks,
Edwin

Outcomes