1 | <?php namespace Limoncello\Tests\Auth\Authorization\PolicyEnforcement\Data\Policies; |
||
28 | abstract class Messaging extends General |
||
29 | { |
||
30 | /** Operation identity */ |
||
31 | const OPERATION_SEND = 'send_message'; |
||
32 | |||
33 | /** |
||
34 | * @return PolicyInterface |
||
35 | */ |
||
36 | public static function policyCanSendMessage() |
||
37 | { |
||
38 | return (new Policy([static::rulePermit()], RuleAlgorithm::denyUnlessPermit())) |
||
39 | ->setTarget(static::targetSendMessage()) |
||
40 | ->setName('Messaging'); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return TargetInterface |
||
45 | */ |
||
46 | protected static function targetSendMessage() |
||
47 | { |
||
48 | return static::targetMulti([ |
||
49 | ContextProperties::PARAM_OPERATION => static::OPERATION_SEND, |
||
50 | ContextProperties::PARAM_IS_WORK_TIME => true, |
||
51 | ]); |
||
52 | } |
||
53 | } |
||
54 |