You are here

function _workflow_access_get_affected_roles in Workflow 7

Same name and namespace in other branches
  1. 7.2 workflow_access/workflow_access.features.inc \_workflow_access_get_affected_roles()

Helper to find the roles needs by an export.

Return value

array A workflow_name-indexed hash of non-default roles in workflow_access for that workflow.

1 call to _workflow_access_get_affected_roles()
workflow_access_features_export in workflow_access/workflow_access.features.inc
Implements hook_features_export().

File

workflow_access/workflow_access.features.inc, line 14

Code

function _workflow_access_get_affected_roles() {
  $sql = <<<SQL
SELECT DISTINCT
  w.name AS wname,
  r.name AS rname
FROM {workflow_access} wa
  INNER JOIN {workflow_states} ws ON wa.sid = ws.sid
  INNER JOIN {workflows} w ON ws.wid = w.wid
  INNER JOIN {role} r ON wa.rid = r.rid
SQL;
  $roles = array();
  foreach (db_query($sql) as $row) {
    $roles[$row->wname][$row->rname] = $row->rname;
  }
  return $roles;
}