Use beginning of UUID for server uuidShort

This commit is contained in:
Dane Everitt 2018-03-03 22:20:53 -06:00
parent 85e75a2808
commit 36837df0a6
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
5 changed files with 63 additions and 4 deletions

View file

@ -303,6 +303,18 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
return $this->getServersForPowerAction($servers, $nodes, true);
}
/**
* Check if a given UUID and UUID-Short string are unique to a server.
*
* @param string $uuid
* @param string $short
* @return bool
*/
public function isUniqueUuidCombo(string $uuid, string $short): bool
{
return ! $this->getBuilder()->where('uuid', '=', $uuid)->orWhere('uuidShort', '=', $short)->exists();
}
/**
* Return an array of server IDs that a given user can access based
* on owner and subuser permissions.