Version 1
[yaffs-website] / vendor / drush / drush / lib / Drush / User / UserSingle7.php
1 <?php
2
3 namespace Drush\User;
4
5 class UserSingle7 extends UserSingleBase {
6
7   public function block() {
8     user_user_operations_block(array($this->account->uid));
9   }
10
11   public function unblock() {
12     user_user_operations_unblock(array($this->account->uid));
13   }
14
15   public function addRole($rid) {
16     user_multiple_role_edit(array($this->account->uid), 'add_role', $rid);
17   }
18
19   public function removeRole($rid) {
20     user_multiple_role_edit(array($this->account->uid), 'remove_role', $rid);
21   }
22
23   function info() {
24     $userinfo = (array)$this->account;
25     unset($userinfo['data']);
26     unset($userinfo['block']);
27     unset($userinfo['form_build_id']);
28     foreach (array('created', 'access', 'login') as $key) {
29       $userinfo['user_' . $key] = format_date($userinfo[$key]);
30     }
31     $userinfo['user_status'] = $userinfo['status'] ? 'active' : 'blocked';
32     return $userinfo;
33   }
34
35   function password($pass) {
36     user_save($this->account, array('pass' => $pass));
37   }
38
39   public function getUsername() {
40     return $this->account->name;
41   }
42
43   public function id() {
44     return $this->account->uid;
45   }
46 }