Ticket #826 (closed enhancement: wontfix)
Add id attribute to the IUser Interface
| Reported by: | rogerjose81 | Owned by: | xue |
|---|---|---|---|
| Priority: | low | Milestone: | 3.1.2 |
| Component: | Prado Framework v3 | Version: | 3.1 |
| Severity: | minor | Keywords: | |
| Cc: |
Description
It is often necessary to obtain the ID of the authenticated user, to achieve this purpose with the current implementation is necessary to make a query to the database to obtain the record that matches with the username. For performance and simplicity reasons it would be useful to be able to access this value without having to make a request to the database to obtain it.
So, with the implementation proposal would save this step, since the id belonging to the authenticated user could store at the session and hence would be consulted at any time.
Add the next code to the IUser Interface:
/** * @return string user id */ public function getId(); /** * @param string user id */ public function setId($value);
This will require to be implemented these methods in the class System.Security.TUser Whose implementation is absolutely trivial:
Add the next code to the System.Security.TUser class.
/**
* @return string user id, defaults to empty string.
*/
public function getId() {
return $this->getState('Id','');
}
/**
* @param string user id
*/
public function setId($value) {
$this->setState('Id',$value,'');
}
Greetings from Cartagena / Colombia Roger Padilla C.
