$privileges = array
($privileges);
} switch ($operation) { // add to the rules
case self::OP_ADD:
if ($resources !== null
) { // this block will iterate the provided resources
foreach ($resources as $resource) { foreach ($roles as $role) { $rules =&
$this->
_getRules($resource,
$role, true
);
if (0 ===
count($privileges)) { $rules['allPrivileges'
]['type'
] =
$type;
$rules['allPrivileges'
]['assert'
] =
$assert;
if (!
isset($rules['byPrivilegeId'
])) { $rules['byPrivilegeId'
] = array
();
} } else { foreach ($privileges as $privilege) { $rules['byPrivilegeId'
][$privilege]['type'
] =
$type;
$rules['byPrivilegeId'
][$privilege]['assert'
] =
$assert;
} }