PhyrePanel-mirror/web/app/Actions/GetLinuxUser.php

29 lines
451 B
PHP
Raw Normal View History

2024-04-22 11:14:05 +00:00
<?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;
}
}