xref: /dokuwiki/inc/Remote/Response/User.php (revision e4e3d43949dfb6b53840595de532df30a6fdba7b)
1<?php
2
3namespace dokuwiki\Remote\Response;
4
5/**
6 * Represents a user
7 */
8class User extends ApiResponse
9{
10    /** @var string The login name of the user */
11    public $login;
12    /** @var string The full name of the user */
13    public $name;
14    /** @var string The email address of the user */
15    public $mail;
16    /** @var array The groups the user is in */
17    public $groups;
18    /** @var bool Whether the user is a super user */
19    public bool $isAdmin;
20    /** @var bool Whether the user is a manager */
21    public bool $isManager;
22
23    /** @inheritdoc */
24    public function __construct($data)
25    {
26        global $USERINFO;
27        global $INPUT;
28        $this->login = $INPUT->server->str('REMOTE_USER');
29        $this->name = $USERINFO['name'];
30        $this->mail = $USERINFO['mail'];
31        $this->groups = $USERINFO['grps'];
32
33        $this->isAdmin = auth_isAdmin($this->login, $this->groups);
34        $this->isManager = auth_isManager($this->login, $this->groups);
35    }
36}
37