Begin implementation of new daemon authentication scheme

This commit is contained in:
Dane Everitt 2017-09-23 20:45:25 -05:00
parent 8722571037
commit 906a699ee2
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
23 changed files with 796 additions and 145 deletions

View file

@ -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;
}
}