2 Replies Latest reply on Jan 8, 2019 12:38 PM by arif.mohammed

    There is no clear distinction between groups and roles in jBPM

    arif.mohammed

      Hello jBPM team. I should have posted this question here in this forum instead I did it on stackoverflow here. Can any one please look into that and let me know how I can achieve it.

       

      The only possible solution I am thinking right at the moment is to treat userId and groupId as single entity and then have different roles for that single entity which serves my purpose. Any thoughts ? It would be great if kie-server could distinguish between userId, groupId and role.

       

      I am adding the table names, data for more clarity.

       

      CREATE TABLE APP_USERS (USER_NAME VARCHAR2(40));

      CREATE TABLE APP_ROLES (ROLE_NAME VARCHAR2(40));

      CREATE TABLE GROUP_MAPPINGS (USER_NAME VARCHAR2(40), GROUP_NAME VARCHAR2(40), ROLE_NAME VARCHAR2(40));

       

      INSERT INTO APP_USERS VALUES ('Mohammed');

      INSERT INTO APP_USERS VALUES ('Abraham');

       

      INSERT INTO APP_ROLES VALUES ('Staff');

      INSERT INTO APP_ROLES VALUES ('Manager');

      INSERT INTO APP_ROLES VALUES ('Admin');

       

      INSERT INTO GROUP_MAPPINGS VALUES ('Mohammed', 'Office-1', 'Staff');

      INSERT INTO GROUP_MAPPINGS VALUES ('Mohammed', 'Office-1', 'Manager');

      INSERT INTO GROUP_MAPPINGS VALUES ('Mohammed', 'Office-2', 'Admin');

       

      INSERT INTO GROUP_MAPPINGS VALUES ('Abraham', 'Office-1', 'Admin');

      INSERT INTO GROUP_MAPPINGS VALUES ('Abraham', 'Office-2', 'Manager');

       

      And now the queries in jbpm.usergroup.callback.properties

       

      db.user.query = SELECT DISTINCT CONCAT(AU.USER_NAME,GM.GROUP_NAME) FROM APP_USERS AU INNER JOIN GROUP_MAPPINGS GM ON (GM.USER_NAME = AU.USER_NAME) WHERE CONCAT(AU.USER_NAME,GM.GROUP_NAME) = ?

      db.user.roles.query = SELECT ROLE_NAME FROM APP_ROLES WHERE ROLE_NAME = ?

      db.user.roles.query = SELECT DISTINCT ROLE_NAME FROM GROUP_MAPPINGS WHERE concat(USER_NAME,GROUP_NAME) = ?