Ticket #826 (closed enhancement: wontfix)

Opened 8 months ago

Last modified 7 months ago

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.

Attachments

interfaces.php (9.8 kB) - added by rogerjose81 8 months ago.
IUser interface (inside of interfaces.php)
TUser.php (5.7 kB) - added by rogerjose81 8 months ago.
System.Security.TUser class

Change History

Changed 8 months ago by rogerjose81

IUser interface (inside of interfaces.php)

Changed 8 months ago by rogerjose81

System.Security.TUser class

Changed 7 months ago by xue

  • status changed from new to closed
  • resolution set to wontfix

Although the 'id' property may be important, it is not an essential piece of information as required by the auth/user managers, therefore we do not enforce it to be present in the IUser interface.

With the help of TDbUserManager, it is very easy to add this property in application code, as you already show it.

Note: See TracTickets for help on using tickets.