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:
parent
994524b7a1
commit
85a40bf82d
4 changed files with 20 additions and 0 deletions
|
@ -1244,6 +1244,17 @@ $collections = [
|
||||||
'array' => false,
|
'array' => false,
|
||||||
'filters' => [],
|
'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'),
|
'$id' => ID::custom('passwordHistory'),
|
||||||
'type' => Database::VAR_STRING,
|
'type' => Database::VAR_STRING,
|
||||||
|
|
|
@ -77,6 +77,13 @@ class User extends Model
|
||||||
'default' => true,
|
'default' => true,
|
||||||
'example' => true,
|
'example' => true,
|
||||||
])
|
])
|
||||||
|
->addRule('labels', [
|
||||||
|
'type' => self::TYPE_STRING,
|
||||||
|
'description' => 'Labels for the user.',
|
||||||
|
'default' => [],
|
||||||
|
'example' => ['vip'],
|
||||||
|
'array' => true,
|
||||||
|
])
|
||||||
->addRule('passwordUpdate', [
|
->addRule('passwordUpdate', [
|
||||||
'type' => self::TYPE_DATETIME,
|
'type' => self::TYPE_DATETIME,
|
||||||
'description' => 'Password update time in ISO 8601 format.',
|
'description' => 'Password update time in ISO 8601 format.',
|
||||||
|
|
|
@ -39,6 +39,7 @@ trait AccountBase
|
||||||
$this->assertEquals(true, $dateValidator->isValid($response['body']['registration']));
|
$this->assertEquals(true, $dateValidator->isValid($response['body']['registration']));
|
||||||
$this->assertEquals($response['body']['email'], $email);
|
$this->assertEquals($response['body']['email'], $email);
|
||||||
$this->assertEquals($response['body']['name'], $name);
|
$this->assertEquals($response['body']['name'], $name);
|
||||||
|
$this->assertEquals($response['body']['labels'], []);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for FAILURE
|
* Test for FAILURE
|
||||||
|
|
|
@ -35,6 +35,7 @@ trait UsersBase
|
||||||
$this->assertEquals($body['email'], 'cristiano.ronaldo@manchester-united.co.uk');
|
$this->assertEquals($body['email'], 'cristiano.ronaldo@manchester-united.co.uk');
|
||||||
$this->assertEquals($body['status'], true);
|
$this->assertEquals($body['status'], true);
|
||||||
$this->assertGreaterThan('2000-01-01 00:00:00', $body['registration']);
|
$this->assertGreaterThan('2000-01-01 00:00:00', $body['registration']);
|
||||||
|
$this->assertEquals($body['labels'], []);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Create with Custom ID for SUCCESS
|
* Test Create with Custom ID for SUCCESS
|
||||||
|
|
Loading…
Reference in a new issue