PageRenderTime 74ms CodeModel.GetById 69ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/web/concrete/core/models/permission/keys/workflow.php

https://github.com/glockops/concrete5
PHP | 30 lines | 28 code | 2 blank | 0 comment | 1 complexity | 185a6231c00ed33ed8be068562a89e12 MD5 | raw file
 1<?
 2defined('C5_EXECUTE') or die("Access Denied.");
 3abstract class Concrete5_Model_WorkflowPermissionKey extends PermissionKey {
 4
 5	public function getCurrentlyActiveUsers(WorkflowProgress $wp) {
 6		$paa = $this->getPermissionAccessObject();
 7		if (!$paa) {
 8			return array();
 9		}
10		$paa->setWorkflowProgressObject($wp);
11		$included = $this->getAccessListItems(PermissionKey::ACCESS_TYPE_INCLUDE);
12		$excluded = $this->getAccessListItems(PermissionKey::ACCESS_TYPE_EXCLUDE);
13		$included = PermissionDuration::filterByActive($included);
14		$excluded = PermissionDuration::filterByActive($excluded);
15		$users = array();
16		$usersExcluded = array();
17		foreach($included as $inc) {
18			$pae = $inc->getAccessEntityObject();
19			$users = array_merge($users, $pae->getAccessEntityUsers($paa));	
20		}
21		$users = array_unique($users);
22
23		foreach($excluded as $inc) {
24			$pae = $inc->getAccessEntityObject();
25			$usersExcluded = array_merge($usersExcluded, $pae->getAccessEntityUsers());	
26		}
27		$users = array_diff($users, $usersExcluded);
28		return $users;	
29	}
30}