english/administrator/components/com_contact/controllers/contact.php
/**
	 * Method override to check if you can edit an existing record.
	 *
	 * @param	array	$data	An array of input data.
	 * @param	string	$key	The name of the key for the primary key.
	 *
	 * @return	boolean
	 * @since	1.6
	 */
Method override to check if you can edit an existing record.
@param       array   $data   An array of input data.
@param       string  $key    The name of the key for the primary key.


Method override to check if you can edit an existing record . @param array $data An array of input data . @param string $key The name of the key for the primary key .
protected function allowEdit($data = array(), $key = 'id')
	{
		$recordId	= (int) isset($data[$key]) ? $data[$key] : 0;
		$user		= JFactory::getUser();
		$userId		= $user->get('id');
		$categoryId	= (int) isset($data['catid']) ? $data['catid'] : 0;
		if ($user->authorise('core.edit', $this->option.'.category.'.$categoryId)) {
			return true;
		}
		if ($user->authorise('core.edit.own', $this->option.'.category.'.$categoryId)) {
			$ownerId	= (int) isset($data['created_by']) ? $data['created_by'] : 0;
			if (empty($ownerId) && $recordId) {
				$record		= $this->getModel()->getItem($recordId);
				if (empty($record)) {
					return false;
				}
				$ownerId = $record->created_by;
			}
			if ($ownerId == $userId) {
				return true;
			}
		}
		return parent::allowEdit($data, $key);
	}
protected function allowEdit ( $ data = array ( ) , $ key = 'id' ) { $ recordId = ( int ) isset ( $ data [ $ key ] ) ? $ data [ $ key ] : 0 ; $ user = JFactory :: getUser ( ) ; $ userId = $ user -> get ( 'id' ) ; $ categoryId = ( int ) isset ( $ data [ 'catid' ] ) ? $ data [ 'catid' ] : 0 ; if ( $ user -> authorise ( 'core.edit' , $ this -> option . '.category.' . $ categoryId ) ) { return true ; } if ( $ user -> authorise ( 'core.edit.own' , $ this -> option . '.category.' . $ categoryId ) ) { $ ownerId = ( int ) isset ( $ data [ 'created_by' ] ) ? $ data [ 'created_by' ] : 0 ; if ( empty ( $ ownerId ) && $ recordId ) { $ record = $ this -> getModel ( ) -> getItem ( $ recordId ) ; if ( empty ( $ record ) ) { return false ; } $ ownerId = $ record -> created_by ; } if ( $ ownerId == $ userId ) { return true ; } } return parent :: allowEdit ( $ data , $ key ) ; }
Method override to check if you can edit an existing record.
Method override to check if you can edit an existing record .
// Initialise variables. // Check general edit permission first. // Fallback on edit.own. // First test if the permission is available. // Now test the owner is the user. // Need to do a lookup from the model. // If the owner matches 'me' then do the test. // Since there is no asset tracking, revert to the component permissions.