1
0
Fork 0
mirror of synced 2024-07-03 21:50:34 +12:00

Add a new labels attribute to the Users collection

This labels attribute can be used apply labels to users. These labels
can eventually be used:

* with permissions to grant access
* to filter users in the Users collection
This commit is contained in:
Steven Nguyen 2023-05-26 17:15:38 -07:00
parent 994524b7a1
commit 85a40bf82d
No known key found for this signature in database
4 changed files with 20 additions and 0 deletions

View file

@ -1244,6 +1244,17 @@ $collections = [
'array' => false,
'filters' => [],
],
[
'$id' => ID::custom('labels'),
'type' => Database::VAR_STRING,
'format' => '',
'size' => 128,
'signed' => true,
'required' => false,
'default' => null,
'array' => true,
'filters' => [],
],
[
'$id' => ID::custom('passwordHistory'),
'type' => Database::VAR_STRING,

View file

@ -77,6 +77,13 @@ class User extends Model
'default' => true,
'example' => true,
])
->addRule('labels', [
'type' => self::TYPE_STRING,
'description' => 'Labels for the user.',
'default' => [],
'example' => ['vip'],
'array' => true,
])
->addRule('passwordUpdate', [
'type' => self::TYPE_DATETIME,
'description' => 'Password update time in ISO 8601 format.',

View file

@ -39,6 +39,7 @@ trait AccountBase
$this->assertEquals(true, $dateValidator->isValid($response['body']['registration']));
$this->assertEquals($response['body']['email'], $email);
$this->assertEquals($response['body']['name'], $name);
$this->assertEquals($response['body']['labels'], []);
/**
* Test for FAILURE

View file

@ -35,6 +35,7 @@ trait UsersBase
$this->assertEquals($body['email'], 'cristiano.ronaldo@manchester-united.co.uk');
$this->assertEquals($body['status'], true);
$this->assertGreaterThan('2000-01-01 00:00:00', $body['registration']);
$this->assertEquals($body['labels'], []);
/**
* Test Create with Custom ID for SUCCESS