RoleAPI::canUpdate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
class RoleAPI extends VolunteerAPI
3
{
4
    use Processor;
0 ignored issues
show
introduced by
The trait Processor requires some properties which are not provided by RoleAPI: $startTime, $certs, $endTime, $mail, $uid, $title
Loading history...
5
6
    public function __construct()
7
    {
8
        parent::__construct('roles', 'short_name');
9
    }
10
11
    protected function canEditDept($request, $deptId)
12
    {
13
        if($this->isVolunteerAdmin($request))
14
        {
15
            return true;
16
        }
17
        return $this->isUserDepartmentLead($deptId, $this->user);
18
    }
19
20
    protected function canUpdate($request, $entity)
21
    {
22
        return $this->canEditDept($request, $entity['departmentID']);
23
    }
24
25
    protected function canDelete($request, $entity)
26
    {
27
        return $this->canUpdate($request, $entity);
28
    }
29
30
    protected function processEntry($entry, $request)
31
    {
32
        return $this->processRole($entry, $request);
33
    }
34
}
35
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
36