You are viewing documentation for an outdated version. It is no longer supported!

Users

The available User resource supports full CRUD operations. This sections highlights a few important concepts.

Creating new user

When you create a new user, it's important that that all required properties are set. See Redmine's docsopen in new window for additional details.

use Aedart\Redmine\User;

$user = User::create([
    'login' => 'jimmy',
    'password' => '[...not shown...]',
    'firstname' => 'Jimmy',
    'lastname' => 'Thomsen',
    'mail' => 'jimmy@example.org'
]);

Change user's status

Set the status property, when you wish to change a user's status.

$user->update([
    'status' => User::STATUS_LOCKED
]);

Change notifications

The mail_notification can be specified, when you wish to set or change the user's email notification settings.

use Aedart\Redmine\User;

$user->update([
    'mail_notification' => User::NONE_MAIL_NOTIFICATION
]);

User's issues

The User resource offers a few ways to obtain issues that a user has authored or is directly assigned to.

// Issues user has created
$authored = $user
    ->authoredIssues()
    ->fetch();

// ...Or issues assigned to user
$assigned = $user
    ->assignedIssues()
    ->fetch();