aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Routes/ConfigValues/Authority.php
blob: 1f8ca7072bdbb365868aa8a5a37a7d3b4de730ff (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\ConfigValues;

use User;

class Authority
{
    /**
     * @SuppressWarnings(PHPMD.Superglobals)
     */
    public static function canShowConfigValue(User $user, ?\Range $range)
    {
        // Sonderfall: globale Range
        if (!$range) {
            return $GLOBALS['perm']->have_perm('root', $user->id);
        }

        return $range->isEditableByUser($user->id);
    }

    public static function canEditConfigValue(User $user, ?\Range $range)
    {
        return self::canShowConfigValue($user, $range);
    }
}