Example #1
0
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $rootCategory = JUDirectoryFrontHelperCategory::getRootCategory();
     if ($recordId && $recordId == $rootCategory->id) {
         return false;
     }
     if ($user->authorise('judir.category.edit', 'com_judirectory.category.' . $recordId)) {
         return true;
     }
     if ($user->authorise('judir.category.edit.own', 'com_judirectory.category.' . $recordId)) {
         $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.
  *
  * @param     array      $data    An array of input data.
  * @param     string     $key     The name of the key for the primary key.
  *
  * @return    boolean
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $uid = $user->get('id');
     $id = (int) isset($data[$key]) ? $data[$key] : 0;
     $owner = (int) isset($data['created_by']) ? $data['created_by'] : 0;
     // Check general edit permission first.
     if ($user->authorise('core.edit', 'com_pfrepo.directory.' . $id)) {
         return true;
     }
     // Fallback on edit.own.
     if ($user->authorise('core.edit.own', 'com_pfrepo.directory.' . $id)) {
         // Now test the owner is the user.
         if (!$owner && $id) {
             $record = $this->getModel()->getItem($id);
             if (empty($record)) {
                 return false;
             }
             $owner = $record->created_by;
         }
         if ($owner == $uid) {
             return true;
         }
     }
     // Fall back to the component permissions.
     return parent::allowEdit($data, $key);
 }
Example #3
0
 /**
  * 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   3.1
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     // Since there is no asset tracking and no categories, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
Example #4
0
 /**
  * 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // Check general edit permission first.
     if ($user->authorise('core.edit', 'com_places.point.' . $recordId)) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($user->authorise('core.edit.own', 'com_places.point.' . $recordId)) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->created_by;
         }
         // If the owner matches 'me' then do the test.
         if ($ownerId == $userId) {
             return true;
         }
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
Example #5
0
 /**
  * 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $canDo = ZhYandexMapHelper::getMarkerActions($recordId);
     $canEdit = $canDo->get('core.edit');
     $isEnabledEditOwn = $canDo->get('core.edit.own');
     if ($canEdit || $canEditOwn) {
     }
     // Check general edit permission first.
     if ($canEdit) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($isEnabledEditOwn) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['createdbyuser']) ? $data['createdbyuser'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->createdbyuser;
         }
         // If the owner matches 'me' then do the test.
         if ($ownerId == $userId) {
             return true;
         }
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
Example #6
0
 /**
  * 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $permissions = SibdietHelper::getUserPermissions();
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // Check requests manage permission first.
     if ($this->input->get('return') == 'requestschecks') {
         if (in_array('requestschecks', $permissions)) {
             return parent::allowEdit($data, $key);
         }
     } elseif (in_array('requests', $permissions)) {
         // Check that diet not started
         if ($recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if ($record->room1 || $record->room2 || $record->room3 || $record->room4 || $record->room5 || $record->room6) {
                 return false;
             }
             // Now test the owner is the user.
             $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
             if (empty($ownerId)) {
                 if (empty($record)) {
                     return false;
                 }
                 $ownerId = $record->created_by;
             }
             // If the owner matches 'me' then do the test.
             if ($ownerId == $userId) {
                 return true;
             }
         }
     }
     return false;
 }
Example #7
0
 /**
  * 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // If we get a deny at the component level, we cannot override here.
     if (!parent::allowEdit($data, $key)) {
         return false;
     }
     // Check general edit permission first.
     if ($user->authorise('core.edit', 'com_content.article.' . $recordId)) {
         return true;
     }
     // Fallback on edit.own.
     // First test if the permission is available.
     if ($user->authorise('core.edit.own', 'com_content.article.' . $recordId)) {
         // Now test the owner is the user.
         $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $record = $this->getModel()->getItem($recordId);
             if (empty($record)) {
                 return false;
             }
             $ownerId = $record->created_by;
         }
         // If the owner matches 'me' then permission is granted.
         if ($ownerId == $userId) {
             return true;
         }
     }
     return false;
 }
Example #8
0
 protected function allowEdit($data = array(), $key = 'id')
 {
     if (JAccess::check($data[$key], 'core.admin')) {
         if (!JFactory::getUser()->authorise('core.admin')) {
             return false;
         }
     }
     return parent::allowEdit($data, $key);
 }
Example #9
0
 /**
  * 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $permissions = SibdietHelper::getUserPermissions();
     if (in_array('sweeteners', $permissions)) {
         return parent::allowEdit($data, $key);
     } else {
         return false;
     }
 }
Example #10
0
 /**
  * Overrides JControllerForm::allowEdit
  *
  * Checks that non-Super Admins are not editing Super Admins.
  *
  * @param	array	An array of input data.
  * @param	string	The name of the key for the primary key.
  *
  * @return	boolean
  * @since	1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Edit a Super Admin User Group is only allowed to a Super Admin
     if (JAccess::checkGroup($data[$key], 'core.admin')) {
         if (!JFactory::getUser()->authorise('core.admin')) {
             return false;
         }
     }
     return parent::allowEdit($data, $key);
 }
Example #11
0
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $allow = null;
     $allow = $user->authorise('core.edit', 'com_phocagallery');
     if ($allow === null) {
         return parent::allowEdit($data, $key);
     } else {
         return $allow;
     }
 }
Example #12
0
 /**
  * Overrides JControllerForm::allowEdit
  *
  * Checks that non-Super Admins are not editing Super Admins.
  *
  * @param	array	An array of input data.
  * @param	string	The name of the key for the primary key.
  *
  * @return	boolean
  * @since	1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Check if this group is a Super Admin
     if (JAccess::checkGroup($data[$key], 'core.admin')) {
         // If I'm not a Super Admin, then disallow the edit.
         if (!JFactory::getUser()->authorise('core.admin')) {
             return false;
         }
     }
     return parent::allowEdit($data, $key);
 }
 /**
  * Переопределение метода для проверки,
  * может ли пользователь редактировать существующую запись.
  *
  * @param   array   $data  Массив данных.
  * @param   string  $key   Имя первичного ключа.
  *
  * @return  boolean  True, если разрешено редактировать запись.
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     if ($recordId) {
         // Проверка редактирования на уровне записи.
         return JFactory::getUser()->authorise('core.edit', $this->option . '.message.' . $recordId);
     } else {
         // Проверка редактирования на уровне компонента.
         return parent::allowEdit($data, $key);
     }
 }
Example #14
0
 /**
  * Overrides JControllerForm::allowEdit
  *
  * Checks that non-Super Admins are not editing Super Admins.
  *
  * @param   array   $data  An array of input data.
  * @param   string  $key   The name of the key for the primary key.
  *
  * @return  boolean  True if allowed, false otherwise.
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Check if this person is a Super Admin
     if (JAccess::check($data[$key], 'core.admin')) {
         // If I'm not a Super Admin, then disallow the edit.
         if (!User::authorise('core.admin')) {
             return false;
         }
     }
     return parent::allowEdit($data, $key);
 }
Example #15
0
 /**
  * Method to check if you can add a new 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.0.0
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     // If the category has been passed in the URL check it.
     $allow = $user->authorise('core.edit', $this->option . '.discount');
     if ($allow !== null) {
         return $allow;
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
Example #16
0
 /**
  * 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Initialise variables.
     $user = JFactory::getUser();
     $allow = null;
     $allow = $user->authorise('core.edit', 'com_jdownloads');
     if ($allow === null) {
         return parent::allowEdit($data, $key);
     } else {
         return $allow;
     }
 }
Example #17
0
 /**
  * Method to check if you can add a new 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $categoryId = 0;
     if ($recordId) {
         $categoryId = (int) $this->getModel()->getItem($recordId)->catid;
     }
     if ($categoryId) {
         // The category has been set. Check the category permissions.
         return JFactory::getUser()->authorise('core.edit', $this->option . '.category.' . $categoryId);
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
Example #18
0
 /**
  * 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Initialise variables.
     $user = JFactory::getUser();
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $categoryId = 0;
     if ($categoryId) {
         // The category has been set. Check the category permissions.
         return $user->authorise('core.edit', $this->option . '.category.' . $categoryId);
     } else {
         // Since there is no asset tracking, revert to the component permissions.
         return parent::allowEdit($data, $key);
     }
 }
Example #19
0
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $folderId = 0;
     if ($recordId) {
         $folderId = (int) $this->getModel()->getItem($recordId)->folder;
     }
     if ($folderId) {
         // Folder Permissions
         return $user->authorise('core.edit', $this->option . '.folder.' . $folderId);
     } else {
         // Component Permissions
         return parent::allowEdit($data, $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.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     // Since there is no asset tracking, fallback to the component permissions.
     if (!$recordId) {
         return parent::allowEdit($data, $key);
     }
     // Get the item.
     $item = $this->getModel()->getItem($recordId);
     // Since there is no item, return false.
     if (empty($item)) {
         return false;
     }
     $user = JFactory::getUser();
     // Check if can edit own core.edit.own.
     $canEditOwn = $user->authorise('core.edit.own', $this->option . '.category.' . (int) $item->catid) && $item->created_by == $user->id;
     // Check the category core.edit permissions.
     return $canEditOwn || $user->authorise('core.edit', $this->option . '.category.' . (int) $item->catid);
 }
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $asset = 'com_authorlist.author.' . $recordId;
     $db = JFactory::getDbo();
     $query = 'SELECT userid FROM #__authorlist WHERE id=' . $recordId;
     $db->setQuery($query);
     $user_id = $db->loadResult();
     $params = JComponentHelper::getParams('com_authorlist');
     if ($user->authorise('core.edit', $asset)) {
         return true;
     }
     if ($params->get('show_author_edit', 1)) {
         if ($user_id == $user->get('id')) {
             return true;
         }
     }
     return parent::allowEdit($data, $key);
 }
Example #22
0
 /**
  * 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $categoryId = 0;
     if ($recordId) {
         $categoryId = (int) $this->getModel()->getItem($recordId)->catid;
     }
     if ($categoryId) {
         // The category has been set. Check the category permissions.
         $canEdit = $user->authorise('core.edit', $this->option . '.category.' . $categoryId);
     } else {
         // Since there is no asset tracking, revert to the component permissions.
         $canEdit = parent::allowEdit($data, $key);
     }
     if ($recordId && $canEdit && !$user->authorise('core.admin')) {
         $canEdit = !$this->getModel()->isPublished($this->getModel()->getItem($recordId));
     }
     return $canEdit;
 }
Example #23
0
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     if ($user->authorise('judir.listing.edit', 'com_judirectory.listing.' . $recordId)) {
         return true;
     }
     if ($user->authorise('judir.listing.edit.own', 'com_judirectory.listing.' . $recordId)) {
         $ownerId = 0;
         if ($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);
 }
Example #24
0
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     if ($user->authorise('core.edit', 'com_bt_socialconnect.message.' . $recordId)) {
         return true;
     }
     if ($user->authorise('core.edit.own', 'com_bt_socialconnect.message.' . $recordId)) {
         $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0;
         if (empty($ownerId) && $recordId) {
             // Need to do a lookup from the model.
             $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.
  *
  * @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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     // Zero record (id:0), return component edit permission by calling parent controller method
     if (!$recordId) {
         return parent::allowEdit($data, $key);
     }
     // Check edit on the record asset (explicit or inherited)
     if ($user->authorise('core.edit', 'com_content.article.' . $recordId)) {
         return true;
     }
     // Check edit own on the record asset (explicit or inherited)
     if ($user->authorise('core.edit.own', 'com_content.article.' . $recordId)) {
         // Existing record already has an owner, get it
         $record = $this->getModel()->getItem($recordId);
         if (empty($record)) {
             return false;
         }
         // Grant if current user is owner of the record
         return $user->get('id') == $record->created_by;
     }
     return false;
 }
Example #26
0
 /**
  * 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
  * 
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     $allow = null;
     $category_id = JArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
     if ($category_id) {
         // The category has been set. Check the category permissions.
         $allow = $user->authorise('core.edit', $category_component . '.category.' . $category_id);
     }
     if ($allow === null) {
         // Since there is no asset tracking, revert to the component permissions.
         return parent::allowEdit($data, $key);
     } else {
         return $allow;
     }
 }
 /**
  * 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   3.2
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Initialise variables.
     $recordId = (int) isset($data[$key]) ? $data[$key] : 0;
     $user = JFactory::getUser();
     $userId = $user->get('id');
     // Check general edit permission first.
     if ($user->authorise('core.edit', 'com_modules.module.' . $recordId)) {
         return true;
     }
     // Since there is no asset tracking, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
Example #28
0
 /**
  * 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   3.1
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     // Since there is no asset tracking and no categories, revert to the component permissions.
     return parent::allowEdit($data, $key);
 }
Example #29
0
 /**
  * Method to check if you can add a new 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     $user = JFactory::getUser();
     return parent::allowEdit($data, $key);
 }
Example #30
0
 /**
  * Method to check if you can add a new 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
  */
 protected function allowEdit($data = array(), $key = 'id')
 {
     return parent::allowEdit($data, $key);
 }