From 38aa3a294d576e26e18410b7d84af7c57347799a Mon Sep 17 00:00:00 2001 From: Thibault Dockx <thibault.dockx@fusiondirectory.org> Date: Mon, 20 Jan 2025 17:43:30 +0000 Subject: [PATCH] :sparkles: (User) - lock edition Lock edition if user is locked. --- plugins/personal/generic/class_user.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 68cd52544..8ddca7a4b 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -262,6 +262,7 @@ class user extends simplePlugin global $config; parent::__construct($dn, $object, $parent, $mainTab); + if ($this->is_template && !$this->initially_was_account) { $this->attributesAccess['userPassword']->setValue('%askme%'); } @@ -275,6 +276,12 @@ class user extends simplePlugin $this->attributesAccess['jpegPhoto']->setPlaceholder(fread($fd, filesize($filename))); $this->was_locked = $this->attributesAccess['userPassword']->isLocked(); + if ($this->was_locked){ + $this->read_only = TRUE; + $warning = new FusionDirectoryWarning(nl2br(htmlescape(sprintf(_("This user account is locked ! Unlock to edit first."))))); + $warning->display(); + } + // Do not apply automatic snap on templates nor if the DN is not yet processed (new creation from template) if ($this->is_template !== TRUE && $this->dn !== 'new') { // Verification is snapshot is enabled and automatic. @@ -286,6 +293,17 @@ class user extends simplePlugin } } +// private function isUserLocked () : bool +// { +// $result = FALSE; +// +// if (isset($this->attributesAccess['userPassword']) && preg_match('/^\{[^\}]/', $this->attributesAccess['userPassword']->getValue())) { +// $result = preg_match('/^[^\}]*+\}!/', $this->attributesAccess['userPassword']->getValue()) === 1; +// } +// +// return $result; +// } + function resetCopyInfos () { parent::resetCopyInfos(); -- GitLab