mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-01-27 22:38:28 +00:00
Replace Factory::getUser() with Factory::getApplication()->getIdentity()
This commit is contained in:
parent
92d01d2bc6
commit
01bc443bc0
@ -71,7 +71,7 @@ class WeblinkModel extends AdminModel
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Factory::getUser()->authorise('core.delete', 'com_weblinks.category.' . (int) $record->catid);
|
return Factory::getApplication()->getIdentity()->authorise('core.delete', 'com_weblinks.category.' . (int) $record->catid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,7 +87,7 @@ class WeblinkModel extends AdminModel
|
|||||||
{
|
{
|
||||||
if (!empty($record->catid))
|
if (!empty($record->catid))
|
||||||
{
|
{
|
||||||
return Factory::getUser()->authorise('core.edit.state', 'com_weblinks.category.' . (int) $record->catid);
|
return Factory::getApplication()->getIdentity()->authorise('core.edit.state', 'com_weblinks.category.' . (int) $record->catid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::canEditState($record);
|
return parent::canEditState($record);
|
||||||
@ -239,7 +239,7 @@ class WeblinkModel extends AdminModel
|
|||||||
protected function prepareTable($table)
|
protected function prepareTable($table)
|
||||||
{
|
{
|
||||||
$date = Factory::getDate();
|
$date = Factory::getDate();
|
||||||
$user = Factory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
|
$table->title = htmlspecialchars_decode($table->title, ENT_QUOTES);
|
||||||
$table->alias = ApplicationHelper::stringURLSafe($table->alias);
|
$table->alias = ApplicationHelper::stringURLSafe($table->alias);
|
||||||
@ -434,6 +434,6 @@ class WeblinkModel extends AdminModel
|
|||||||
*/
|
*/
|
||||||
private function canCreateCategory()
|
private function canCreateCategory()
|
||||||
{
|
{
|
||||||
return Factory::getUser()->authorise('core.create', 'com_weblinks');
|
return Factory::getApplication()->getIdentity()->authorise('core.create', 'com_weblinks');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ class WeblinksModel extends ListModel
|
|||||||
// Create a new query object.
|
// Create a new query object.
|
||||||
$db = $this->getDbo();
|
$db = $this->getDbo();
|
||||||
$query = $db->getQuery(true);
|
$query = $db->getQuery(true);
|
||||||
$user = Factory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
// Select the required fields from the table.
|
// Select the required fields from the table.
|
||||||
$query->select(
|
$query->select(
|
||||||
|
@ -111,7 +111,7 @@ class CategoryModel extends ListModel
|
|||||||
*/
|
*/
|
||||||
protected function getListQuery()
|
protected function getListQuery()
|
||||||
{
|
{
|
||||||
$viewLevels = Factory::getUser()->getAuthorisedViewLevels();
|
$viewLevels = Factory::getApplication()->getIdentity()->getAuthorisedViewLevels();
|
||||||
|
|
||||||
// Create a new query object.
|
// Create a new query object.
|
||||||
$db = $this->getDbo();
|
$db = $this->getDbo();
|
||||||
@ -263,7 +263,7 @@ class CategoryModel extends ListModel
|
|||||||
$id = $app->input->get('id', 0, 'int');
|
$id = $app->input->get('id', 0, 'int');
|
||||||
$this->setState('category.id', $id);
|
$this->setState('category.id', $id);
|
||||||
|
|
||||||
$user = Factory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
if (!$user->authorise('core.edit.state', 'com_weblinks') && !$user->authorise('core.edit', 'com_weblinks'))
|
if (!$user->authorise('core.edit.state', 'com_weblinks') && !$user->authorise('core.edit', 'com_weblinks'))
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ class FormModel extends WeblinkModel
|
|||||||
$form = $this->loadForm('com_weblinks.form', 'weblink', array('control' => 'jform', 'load_data' => $loadData));
|
$form = $this->loadForm('com_weblinks.form', 'weblink', array('control' => 'jform', 'load_data' => $loadData));
|
||||||
|
|
||||||
// Disable the buttons and just allow editor none for not authenticated users
|
// Disable the buttons and just allow editor none for not authenticated users
|
||||||
if (Factory::getUser()->guest)
|
if (Factory::getApplication()->getIdentity()->guest)
|
||||||
{
|
{
|
||||||
$form->setFieldAttribute('description', 'editor', 'none');
|
$form->setFieldAttribute('description', 'editor', 'none');
|
||||||
$form->setFieldAttribute('description', 'buttons', 'no');
|
$form->setFieldAttribute('description', 'buttons', 'no');
|
||||||
|
@ -74,7 +74,7 @@ class WeblinkModel extends ItemModel
|
|||||||
*/
|
*/
|
||||||
public function getItem($pk = null)
|
public function getItem($pk = null)
|
||||||
{
|
{
|
||||||
$user = Factory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('weblink.id');
|
$pk = (!empty($pk)) ? $pk : (int) $this->getState('weblink.id');
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class HtmlView extends BaseHtmlView
|
|||||||
*/
|
*/
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
$user = Factory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
// Get model data.
|
// Get model data.
|
||||||
$this->state = $this->get('State');
|
$this->state = $this->get('State');
|
||||||
|
@ -21,7 +21,7 @@ use Joomla\CMS\Uri\Uri;
|
|||||||
$params = &$this->category->params;
|
$params = &$this->category->params;
|
||||||
|
|
||||||
// Get the user object.
|
// Get the user object.
|
||||||
$user = Factory::getUser();
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
|
||||||
// Check if user is allowed to add/edit based on weblinks permissinos.
|
// Check if user is allowed to add/edit based on weblinks permissinos.
|
||||||
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $this->category->id);
|
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $this->category->id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user