aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Routes/Institutes/Authority.php
blob: c6ee43bee90d6f8b8b519d8ff262faa2f96077ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

namespace JsonApi\Routes\Institutes;

use Institute;
use User;

class Authority
{
    /**
     * @SuppressWarnings(PHPMD.Superglobals)
     */
    public static function canEditInstitute(User $user, Institute $institute)
    {
        return $GLOBALS['perm']->have_studip_perm('admin', $institute->id, $user->id);
    }

    /**
     * @SuppressWarnings(PHPMD.Superglobals)
     */
    public static function canIndexInstitutesOfUser(User $observer, User $user)
    {
        return $GLOBALS['perm']->have_perm('admin', $observer->id)
            || $observer->id === $user->id;
    }
}