administrator/components/com_categories/controllers/category.php
protected function allowEdit($data = array(), $key = 'parent_id')
	{
		$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
		$user = JFactory::getUser();

		// Check "edit" permission on record asset (explicit or inherited)
		if ($user->authorise('core.edit', $this->extension . '.category.' . $recordId))
		{
			return true;
		}

		// Check "edit own" permission on record asset (explicit or inherited)
		if ($user->authorise('core.edit.own', $this->extension . '.category.' . $recordId))
		{
			// Need to do a lookup from the model to get the owner
			$record = $this->getModel()->getItem($recordId);

			if (empty($record))
			{
				return false;
			}

			$ownerId = $record->created_user_id;

			// If the owner matches 'me' then do the test.
			if ($ownerId == $user->id)
			{
				return true;
			}
		}

		return false;
	}
protected function allowEdit($data = array(), $key = 'parent_id')
	{
		$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
		$user = JFactory::getUser();

		// Check "edit" permission on record asset (explicit or inherited)
		if ($user->authorise('core.edit', $this->extension . '.category.' . $recordId))
		{
			return true;
		}

		// Check "edit own" permission on record asset (explicit or inherited)
		if ($user->authorise('core.edit.own', $this->extension . '.category.' . $recordId))
		{
			// Need to do a lookup from the model to get the owner
			$record = $this->getModel()->getItem($recordId);

			if (empty($record))
			{
				return false;
			}

			$ownerId = $record->created_user_id;

			// If the owner matches 'me' then do the test.
			if ($ownerId == $user->id)
			{
				return true;
			}
		}

		return false;
	}
protected function allowEdit ( $ data = array ( ) , $ key = 'parent_id' ) { $ recordId = ( int ) isset ( $ data [ $ key ] ) ? $ data [ $ key ] : 0 ; $ user = JFactory :: getUser ( ) ; // Check "edit" permission on record asset (explicit or inherited) if ( $ user -> authorise ( 'core.edit' , $ this -> extension . '.category.' . $ recordId ) ) { return true ; } // Check "edit own" permission on record asset (explicit or inherited) if ( $ user -> authorise ( 'core.edit.own' , $ this -> extension . '.category.' . $ recordId ) ) { // Need to do a lookup from the model to get the owner $ record = $ this -> getModel ( ) -> getItem ( $ recordId ) ; if ( empty ( $ record ) ) { return false ; } $ ownerId = $ record -> created_user_id ; // If the owner matches 'me' then do the test. if ( $ ownerId == $ user -> id ) { return true ; } } return false ; }
Method to check if you can edit a 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 to check if you can edit a record .