mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
Introduce RoleForm#onRenameSuccess() to be able to overwrite it
This commit is contained in:
parent
d14a2f6958
commit
0a79dcef42
@ -511,11 +511,7 @@ class RoleForm extends RepositoryForm
|
||||
}
|
||||
|
||||
if ($this->getIdentifier() && ($newName = $this->getValue('name')) !== $this->getIdentifier()) {
|
||||
$this->repository->update(
|
||||
$this->getBaseTable(),
|
||||
['parent' => $newName],
|
||||
Filter::where('parent', $this->getIdentifier())
|
||||
);
|
||||
$this->onRenameSuccess($this->getIdentifier(), $newName);
|
||||
}
|
||||
|
||||
if (ConfigFormEventsHook::runOnSuccess($this) === false) {
|
||||
@ -526,6 +522,17 @@ class RoleForm extends RepositoryForm
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update child roles of role $oldName, set their parent to $newName
|
||||
*
|
||||
* @param string $oldName
|
||||
* @param string $newName
|
||||
*/
|
||||
protected function onRenameSuccess(string $oldName, ?string $newName): void
|
||||
{
|
||||
$this->repository->update($this->getBaseTable(), ['parent' => $newName], Filter::where('parent', $oldName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect permissions and restrictions provided by Icinga Web 2 and modules
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user