User: Move `$user:local_name$` handling to class `AdmissionLoader`
This way it also adjusts the roles directly, and not just their copies for the user object
This commit is contained in:
parent
bdd0f204f0
commit
6eb0139446
|
@ -155,9 +155,13 @@ class AdmissionLoader
|
|||
array_diff($role->getPermissions(), $permissions)
|
||||
);
|
||||
|
||||
foreach ($role->getRestrictions() as $name => $restriction) {
|
||||
$roleRestrictions = $role->getRestrictions();
|
||||
foreach ($roleRestrictions as $name => & $restriction) {
|
||||
$restriction = str_replace('$user:local_name$', $user->getLocalUsername(), $restriction);
|
||||
$restrictions[$name][] = $restriction;
|
||||
}
|
||||
|
||||
$role->setRestrictions($roleRestrictions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -252,10 +252,6 @@ class User
|
|||
*/
|
||||
public function setRestrictions(array $restrictions)
|
||||
{
|
||||
foreach ($restrictions as $name => $restriction) {
|
||||
$restrictions[$name] = str_replace('$user:local_name$', $this->getLocalUsername(), $restriction);
|
||||
}
|
||||
|
||||
$this->restrictions = $restrictions;
|
||||
return $this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue