本文整理汇总了PHP中JControllerForm::allowEdit方法的典型用法代码示例。如果您正苦于以下问题:PHP JControllerForm::allowEdit方法的具体用法?PHP JControllerForm::allowEdit怎么用?PHP JControllerForm::allowEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JControllerForm
的用法示例。
在下文中一共展示了JControllerForm::allowEdit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: allowEdit
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);
}
示例2: allowEdit
/**
* 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);
}
示例3: allowEdit
/**
* 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);
}
示例4: allowEdit
/**
* 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);
}
示例5: allowEdit
/**
* 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);
}
示例6: allowEdit
/**
* 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;
}
示例7: allowEdit
/**
* 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;
}
示例8: allowEdit
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);
}
示例9: allowEdit
/**
* 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;
}
}
示例10: allowEdit
/**
* 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);
}
示例11: allowEdit
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;
}
}
示例12: allowEdit
/**
* Переопределение метода для проверки,
* может ли пользователь редактировать существующую запись.
*
* @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);
}
}
示例13: allowEdit
/**
* 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);
}
示例14: allowEdit
/**
* 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);
}
示例15: allowEdit
/**
* 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;
}
}