Begin implementation of new daemon authentication scheme
This commit is contained in:
parent
8722571037
commit
906a699ee2
23 changed files with 796 additions and 145 deletions
|
@ -69,6 +69,26 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI
|
|||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getWithPermissionsUsingUserAndServer($user, $server)
|
||||
{
|
||||
Assert::integerish($user, 'First argument passed to getWithPermissionsUsingUserAndServer must be integer, received %s.');
|
||||
Assert::integerish($server, 'Second argument passed to getWithPermissionsUsingUserAndServer must be integer, received %s.');
|
||||
|
||||
$instance = $this->getBuilder()->with('permissions')->where([
|
||||
['user_id', '=', $user],
|
||||
['server_id', '=', $server],
|
||||
])->first();
|
||||
|
||||
if (is_null($instance)) {
|
||||
throw new RecordNotFoundException;
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -83,4 +103,24 @@ class SubuserRepository extends EloquentRepository implements SubuserRepositoryI
|
|||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getWithKey($user, $server)
|
||||
{
|
||||
Assert::integerish($user, 'First argument passed to getWithKey must be integer, received %s.');
|
||||
Assert::integerish($server, 'Second argument passed to getWithKey must be integer, received %s.');
|
||||
|
||||
$instance = $this->getBuilder()->with('key')->where([
|
||||
['user_id', '=', $user],
|
||||
['server_id', '=', $server],
|
||||
])->first();
|
||||
|
||||
if (is_null($instance)) {
|
||||
throw new RecordNotFoundException;
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue