Completed
Push — master ( ced9b5...a42ee4 )
by Luc
15s
created

MediaSecurity   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 15
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A isAuthorized() 0 9 2
1
<?php
2
3
namespace CultuurNet\UDB3\Media;
4
5
use CultuurNet\UDB3\Offer\Commands\AuthorizableCommandInterface;
6
use CultuurNet\UDB3\Role\ValueObjects\Permission;
7
use CultuurNet\UDB3\Security\SecurityDecoratorBase;
8
9
class MediaSecurity extends SecurityDecoratorBase
10
{
11
    /**
12
     * @inheritdoc
13
     */
14
    public function isAuthorized(AuthorizableCommandInterface $command)
15
    {
16
        // All authenticated users can upload media.
17
        if ($command->getPermission()->sameValueAs(Permission::MEDIA_UPLOADEN())) {
18
            return true;
19
        }
20
21
        return parent::isAuthorized($command);
22
    }
23
}
24