mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
make workgroup explicit
This commit is contained in:
parent
7797d463d7
commit
bdda31975d
8 changed files with 16 additions and 21 deletions
|
|
@ -34,31 +34,15 @@ class BasicAuth implements IAuth {
|
|||
* BasicAuth constructor.
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $workgroup
|
||||
* @param string $password
|
||||
*/
|
||||
public function __construct($username, $password) {
|
||||
list($workgroup, $username) = $this->splitUser($username);
|
||||
public function __construct($username, $workgroup, $password) {
|
||||
$this->username = $username;
|
||||
$this->workgroup = $workgroup;
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Split workgroup from username
|
||||
*
|
||||
* @param $user
|
||||
* @return string[] [$workgroup, $user]
|
||||
*/
|
||||
private function splitUser($user) {
|
||||
if (strpos($user, '/')) {
|
||||
return explode('/', $user, 2);
|
||||
} elseif (strpos($user, '\\')) {
|
||||
return explode('\\', $user);
|
||||
} else {
|
||||
return array(null, $user);
|
||||
}
|
||||
}
|
||||
|
||||
public function getUsername() {
|
||||
return $this->username;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue