jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Libraries/] [Security/] [Model/] [Common/] [User.php] - Blame information for rev 2

 

Line No. Rev Author Line
12simandl<?php
2 
3namespace Phem\Libraries\Security\Model\Common;
4 
5use Phem\Core\Object;
6use Phem\Environment\EnvironmentManager;
7use Phem\Libraries\Forms\Annotations\Input;
8use Phem\Libraries\Forms\Annotations\Select;
9use Phem\Libraries\Forms\Annotations\Form;
10use Phem\Libraries\Validation\Annotations\Validate;
11 
12/**
13 * @Form(action="", method="POST")
14 */
15class User extends Object
16{
17 
18 /** @Input */
19 protected $id;
20 
21 /**
22 * @Input(maxlength=24, required=true)
23 * @Validate(type="ascii")
24 */
25 protected $username;
26 
27 /**
28 * @Input(maxlength=32, required=false)
29 * @Validate(type="alphabet")
30 */
31 protected $name;
32 
33 /**
34 * @Input(maxlength=64, required=false)
35 * @Validate(type="alphabet")
36 */
37 protected $surname;
38 
39 /**
40 * @Input(type="password", required=true)
41 * @Validate(type="password")
42 */
43 protected $password;
44 
45 /**
46 * @Input(maxlength=64, required=true)
47 * @Validate(type="email")
48 */
49 protected $email;
50 protected $session;
51 
52 public function getId()
53 {
54 return $this->id;
55 }
56 
57 public function setId($id)
58 {
59 $this->id = $id;
60 }
61 
62 public function getUsername()
63 {
64 return $this->username;
65 }
66 
67 public function setUsername($username)
68 {
69 $this->username = $username;
70 }
71 
72 public function getName()
73 {
74 return $this->name;
75 }
76 
77 public function setName($name)
78 {
79 $this->name = $name;
80 }
81 
82 public function getSurname()
83 {
84 return $this->surname;
85 }
86 
87 public function setSurname($surname)
88 {
89 $this->surname = $surname;
90 }
91 
92 public function getPassword()
93 {
94 return $this->password;
95 }
96 
97 public function setPassword($password)
98 {
99 $this->password = $password;
100 }
101 
102 public function getEmail()
103 {
104 return $this->email;
105 }
106 
107 public function setEmail($email)
108 {
109 $this->email = $email;
110 }
111 
112 public function getSession()
113 {
114 return $this->session;
115 }
116 
117 public function setSession($session)
118 {
119 $this->session = $session;
120 }
121 
122 public function getGroups()
123 {
124 return EnvironmentManager::getUserManager()->getGroupsOf($this);
125 }
126 
127 public function addToGroup(Group $group)
128 {
129 EnvironmentManager::getUserManager()->addUserToGroup($group, $this);
130 }
131 
132 public function removeFromGroup(Group $group)
133 {
134 EnvironmentManager::getUserManager()->removeUserFromGroup($group, $this);
135 }
136 
137 public function canTask(Task $task)
138 {
139 return EnvironmentManager::getAuthorizationProvider()->canTask($this, $task);
140 }
141 
142 public function isMemberOf(Group $group)
143 {
144 return EnvironmentManager::getUserManager()->isMemberOf($this, $group);
145 }
146 
147 public function delete()
148 {
149 EnvironmentManager::getUserManager()->removeUser($this);
150 }
151 
152 public function save()
153 {
154 if ($this->id == null)
155 EnvironmentManager::getUserManager()->addUser($this);
156 else
157 {
158 EnvironmentManager::getUserManager()->modifyUser($this);
159 }
160 }
161 
162}

Powered by WebSVN 2.2.1