| | 408 | * Assign one or more new permissions to this user |
| | 409 | * @param mixed A permission token ID, name, or array of the same |
| | 410 | **/ |
| | 411 | public function grant( $permissions, $access = 'full' ) |
| | 412 | { |
| | 413 | $permissions = Utils::single_array( $permissions ); |
| | 414 | // Use ids internally for all permissions |
| | 415 | $permissions = array_map(array('ACL', 'token_id'), $permissions); |
| | 416 | |
| | 417 | foreach ( $permissions as $permission ) { |
| | 418 | ACL::grant_user( $this->id, $permission, $access ); |
| | 419 | } |
| | 420 | } |
| | 421 | |
| | 422 | /** |
| | 423 | * Deny one or more permissions to this user |
| | 424 | * @param mixed The permission ID or name to be denied, or an array of the same |
| | 425 | **/ |
| | 426 | public function deny( $permissions ) |
| | 427 | { |
| | 428 | $this->grant( $permissions, 'deny' ); |
| | 429 | } |
| | 430 | |
| | 431 | /** |
| | 432 | * Remove one or more permissions from a user |
| | 433 | * @param mixed a permission ID, name, or array of the same |
| | 434 | **/ |
| | 435 | public function revoke( $permissions ) |
| | 436 | { |
| | 437 | $permissions = Utils::single_array( $permissions ); |
| | 438 | // get token IDs |
| | 439 | $permissions = array_map(array('ACL', 'token_id'), $permissions); |
| | 440 | foreach ( $permissions as $permission ) { |
| | 441 | ACL::revoke_user_permission( $this->id, $permission ); |
| | 442 | } |
| | 443 | } |
| | 444 | |
| | 445 | /** |