diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index 68cd5254431c604563a7cadf1e3c46bfbded22b8..8ddca7a4bdd65759175d32460f42451f0602e9bf 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();