Please enable JavaScript to view this site.

The manual for the JobRouter developer

Navigation: SDK > Interfaces

UserManagerInterface

Scroll Prev Top Next More

Methods

 

Method

Parameters

Parameter description

Return

Description

getCurrentUser

-

-

UserInterface

Returns the currently logged in user

getUserByUsername

$userName: string

Name of the user

UserInterface

Returns the UserInterface for the specified user name

 

Example

 

<?php

 

use JobRouter\Sdk\UserManagerInterface;

 

return function (UserManagerInterface $userInterface): void {

    echo '<h1 style="color: #fc0">JobRouter SDK user interface example!</h1>';

 

    try {

        $currentUser = $userInterface->getCurrentUser();

        // Do something with the $currentUser

 

        $userByName = $userInterface->getUserByUsername('example_user');

        // Do something with the $userByName

    } catch (\JobRouterException) {

        echo '<h3 style="color: #f44;">The user does not exist!</h3>';

    }

};