| Total Complexity | 12 |
| Total Lines | 87 |
| Duplicated Lines | 0 % |
| Coverage | 75% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class AssociationPolicy |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @param User $user |
||
| 12 | * @param $ability |
||
| 13 | * @return bool|null |
||
| 14 | */ |
||
| 15 | 6 | public function before(User $user, $ability) |
|
|
|
|||
| 16 | { |
||
| 17 | 6 | if ($user->isSuperAdmin()) { |
|
| 18 | 1 | return true; |
|
| 19 | } |
||
| 20 | 5 | return null; |
|
| 21 | } |
||
| 22 | |||
| 23 | // Only SuperAdmin And FederationPresident should be able to create Associations |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param User $user |
||
| 27 | * @return bool |
||
| 28 | */ |
||
| 29 | 2 | public function create(User $user) |
|
| 30 | { |
||
| 31 | 2 | if ($user->isFederationPresident()) { |
|
| 32 | 1 | return true; |
|
| 33 | } |
||
| 34 | 1 | return false; |
|
| 35 | } |
||
| 36 | |||
| 37 | // Only SuperAdmin And FederationPresident should be able to create Associations |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param User $user |
||
| 41 | * @param Association $association |
||
| 42 | * @return bool |
||
| 43 | */ |
||
| 44 | public function store(User $user, Association $association) |
||
| 45 | { |
||
| 46 | // if ($user->isFederationPresident()) { |
||
| 47 | return true; |
||
| 48 | // } |
||
| 49 | // return false; |
||
| 50 | } |
||
| 51 | |||
| 52 | // Only SuperAdmin And FederationPresident should be able to delete Associations |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @param User $user |
||
| 56 | * @param Association $association |
||
| 57 | * @return bool |
||
| 58 | */ |
||
| 59 | public function delete(User $user, Association $association) |
||
| 60 | { |
||
| 61 | return $association->belongsToFederationPresident($user); |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * |
||
| 66 | * @param User $user |
||
| 67 | * @param Association $association |
||
| 68 | * @return bool |
||
| 69 | */ |
||
| 70 | 4 | public function edit(User $user, Association $association) |
|
| 82 | } |
||
| 83 | |||
| 84 | 1 | public function update(User $user, Association $association) |
|
| 85 | { |
||
| 86 | 1 | if ($user->isFederationPresident()) { |
|
| 99 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.