Commit 9697f788 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4970 Removed templates on which the user have no rights from template list

Showing with 9 additions and 3 deletions
+9 -3
......@@ -229,9 +229,9 @@ class objects
/* !\brief This method returns a list of all available templates for the given type
*/
static function getTemplates($type)
static function getTemplates($type, $requiredPermissions = 'r')
{
global $config;
global $config, $ui;
$infos = self::infos($type);
......@@ -244,7 +244,13 @@ class objects
$ldap->search('(objectClass=fdTemplate)', array('cn'));
if ($ldap->count() != 0) {
while ($attrs = $ldap->fetch()) {
$templates[$ldap->getDN()] = $attrs['cn'][0]." - ".LDAP::fix($key);
$dn = $ldap->getDN();
if ($requiredPermissions != '') {
if (!preg_match('/'.$requiredPermissions.'/', $ui->get_permissions($dn, $infos['aclCategory'].'/'.'template'))) {
continue;
}
}
$templates[$dn] = $attrs['cn'][0]." - ".LDAP::fix($key);
}
}
}
......
  • bmortier @bmortier

    mentioned in issue #1576 (closed)

    By bmortier on 2017-09-02T15:31:15 (imported from GitLab)

    ·

    mentioned in issue #1576 (closed)

    By bmortier on 2017-09-02T15:31:15 (imported from GitLab)

    Toggle commit list
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment