| 1 |
<?php |
| 2 |
/** |
| 3 |
* Backward-compatible staff guard API. |
| 4 |
* |
| 5 |
* @package WCPOS\WooCommercePOS |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WCPOS\WooCommercePOS\Services; |
| 9 |
|
| 10 |
/** |
| 11 |
* Backward-compatible staff guard. |
| 12 |
* |
| 13 |
* @deprecated Use Permission_Rules::verdict() for complete permission decisions. |
| 14 |
*/ |
| 15 |
class Customer_Account_Guard { |
| 16 |
/** |
| 17 |
* Get protected staff capabilities. |
| 18 |
* |
| 19 |
* @deprecated Use Permission_Rules::protected_capabilities(). |
| 20 |
* @return array |
| 21 |
*/ |
| 22 |
public static function protected_capabilities(): array { |
| 23 |
return Permission_Rules::protected_capabilities(); |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Check whether an actor may modify a target. |
| 28 |
* |
| 29 |
* @deprecated Use Permission_Rules::can_modify(). |
| 30 |
* @param int $actor_id Acting user ID. |
| 31 |
* @param int $target_id Target user ID. |
| 32 |
* @return bool |
| 33 |
*/ |
| 34 |
public static function can_modify( int $actor_id, int $target_id ): bool { |
| 35 |
return Permission_Rules::can_modify( $actor_id, $target_id ); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Temporarily allow a cleared target role. |
| 40 |
* |
| 41 |
* @deprecated Use Permission_Rules::allow_target_roles(). |
| 42 |
* @param int $target_id Cleared target user ID. |
| 43 |
* @return callable |
| 44 |
*/ |
| 45 |
public static function allow_target_roles( int $target_id ): callable { |
| 46 |
return Permission_Rules::allow_target_roles( $target_id ); |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Build the staff account permission error. |
| 51 |
* |
| 52 |
* @deprecated Use Permission_Rules::denial(). |
| 53 |
* @return \WP_Error |
| 54 |
*/ |
| 55 |
public static function denial(): \WP_Error { |
| 56 |
return Permission_Rules::denial(); |
| 57 |
} |
| 58 |
} |
| 59 |
|