Skip to content

Commit 0b663fb

Browse files
authored
Merge pull request #161 from thiagogomesverissimo/master
adicionando suporte a atributos Linux
2 parents db2385c + 5290df6 commit 0b663fb

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

app/Ldap/User.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,20 @@ public static function createOrUpdate(string $username, array $attr, array $grou
9090
$user->setDescription($attr['descricao']);
9191
}
9292

93+
// Atributos para Linux
94+
$username_integer = (int) $username;
95+
if(config('web-ldap-admin.usarAtributosLinux') & $username_integer!=0) {
96+
$user->setAttribute('uid', config('web-ldap-admin.prefixo_linux') . $username);
97+
$user->setAttribute('uidNumber', $username);
98+
$user->setAttribute('gidNumber', config('web-ldap-admin.gid_linux'));
99+
$user->setAttribute('loginShell', '/bin/bash');
100+
$user->setAttribute('unixHomeDirectory', '/home/'. config('web-ldap-admin.prefixo_linux') . $username);
101+
}
102+
93103
$user->save();
94104

105+
$user->setDepartment($attr['setor']);
106+
95107
// Adiciona a um ou mais grupo
96108
LdapGroup::addMember($user, $groups);
97109

config/web-ldap-admin.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,9 @@
7272

7373
# 0 não mostra foto (nem foto fake), 1 mostra foto
7474
'mostrarFoto' => env('MOSTRAR_FOTO', 0),
75+
76+
# Campos para Linux
77+
'usarAtributosLinux' => env('USAR_ATRIBUTOS_LINUX', 0),
78+
'prefixo_linux' => env('PREFIXO_LINUX', 'a'),
79+
'gid_linux' => env('GID_LINUX', 6000),
7580
];

0 commit comments

Comments
 (0)