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