mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-22 15:40:25 +00:00
29 lines
451 B
PHP
29 lines
451 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Actions;
|
||
|
|
||
|
use App\ShellApi;
|
||
|
|
||
|
class GetLinuxUser
|
||
|
{
|
||
|
public $username;
|
||
|
|
||
|
public function setUsername($username)
|
||
|
{
|
||
|
$this->username = $username;
|
||
|
}
|
||
|
|
||
|
public function handle()
|
||
|
{
|
||
|
$username = $this->username;
|
||
|
$user = ShellApi::exec('getent passwd '.$username);
|
||
|
if (empty($user)) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
$user = explode(':', $user);
|
||
|
|
||
|
return $user;
|
||
|
}
|
||
|
}
|