Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI fix: user with authorization to create in at least a category can access editor view in menuitems for other categories #17674

Merged
merged 24 commits into from
Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4ef9d75
Merge remote-tracking branch 'upstream/staging' into staging
LivioCavallo Aug 22, 2017
31de6c3
Merge remote-tracking branch 'upstream/staging' into staging
LivioCavallo Aug 22, 2017
85fa6ee
Merge branch 'staging' into upstream/staging
LivioCavallo Aug 22, 2017
5fd9c71
Merge remote-tracking branch 'upstream/staging' into staging
LivioCavallo Aug 22, 2017
efd8c59
Check authorization on specified category
LivioCavallo Aug 22, 2017
6e0b2a3
added spaces around concat operator
LivioCavallo Aug 22, 2017
b1cdd1a
consistency and language fixes
LivioCavallo Aug 23, 2017
b71dc13
alphabetically reordered .ini file strings
LivioCavallo Aug 23, 2017
15c0350
replaced 'Contrained' with 'Specific' in language file
LivioCavallo Aug 23, 2017
175a328
fixed bug detected by infograf768
LivioCavallo Aug 24, 2017
ff98a79
Require both parameters in view.html.php
ggppdk Aug 25, 2017
c617b84
Require both parameters in form.php
ggppdk Aug 25, 2017
046d976
Merge pull request #1 from ggppdk/patch-38
LivioCavallo Aug 25, 2017
d92100f
Merge pull request #2 from ggppdk/patch-39
LivioCavallo Aug 25, 2017
eab69da
added blank line before conditional
LivioCavallo Aug 25, 2017
667d82d
removed defaulted value for $authorised variable
LivioCavallo Aug 25, 2017
800d6ce
Merge remote-tracking branch 'upstream/staging' into content.edit.vie…
LivioCavallo Aug 26, 2017
c9789af
Merge remote-tracking branch 'upstream/staging' into content.edit.vie…
LivioCavallo Aug 27, 2017
7500347
Merge remote-tracking branch 'upstream/staging' into content.edit.vie…
LivioCavallo Aug 28, 2017
ad148a7
Merge branch 'staging' into content.edit.view.security
infograf768 Aug 8, 2019
0287455
Merge branch 'staging' into content.edit.view.security
infograf768 Aug 9, 2019
c370a51
Merge branch 'staging' into content.edit.view.security
infograf768 Aug 25, 2019
17c1486
Merge branch 'staging' into content.edit.view.security
rdeutz Nov 24, 2019
9c0e5dd
Merge branch 'staging' into content.edit.view.security
rdeutz Dec 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion administrator/language/en-GB/en-GB.com_content.ini
Expand Up @@ -30,8 +30,8 @@ COM_CONTENT_CONFIG_LIST_SETTINGS_DESC="These settings apply for List Layouts Opt
COM_CONTENT_CONFIGURATION="Articles: Options"
COM_CONTENT_CREATE_ARTICLE_CANCEL_REDIRECT_MENU_DESC="Select the page the user will be redirected to after Canceling article submission. The default is to redirect to the same article submission page (cleaning form)."
COM_CONTENT_CREATE_ARTICLE_CANCEL_REDIRECT_MENU_LABEL="Cancel Redirect"
COM_CONTENT_CREATE_ARTICLE_CATEGORY_LABEL="Default Category"
COM_CONTENT_CREATE_ARTICLE_CATEGORY_DESC="If set to 'Yes', this page will only let you create articles in the category selected below."
COM_CONTENT_CREATE_ARTICLE_CATEGORY_LABEL="Specific Category"
COM_CONTENT_CREATE_ARTICLE_CUSTOM_CANCEL_REDIRECT_DESC="If set to 'Yes', you can set a redirection page, distinct from above 'Submission Redirect', to redirect to when user Cancels article submission.<br />If set to 'No', when user Cancels article submission he is redirected to the above 'Submission Redirect' page."
COM_CONTENT_CREATE_ARTICLE_CUSTOM_CANCEL_REDIRECT_LABEL="Custom Redirect on Cancel"
COM_CONTENT_CREATE_ARTICLE_REDIRECTMENU_DESC="Select the page the user will be redirected to after a successful article submission and after cancel (if not set differently below). The default is to redirect to the home page."
Expand Down
4 changes: 2 additions & 2 deletions components/com_content/models/form.php
Expand Up @@ -206,9 +206,9 @@ protected function preprocessForm(JForm $form, $data, $group = 'content')
{
$params = $this->getState()->get('params');

if ($params && $params->get('enable_category') == 1)
if ($params && $params->get('enable_category') == 1 && $params->get('catid'))
{
$form->setFieldAttribute('catid', 'default', $params->get('catid', 1));
$form->setFieldAttribute('catid', 'default', $params->get('catid'));
$form->setFieldAttribute('catid', 'readonly', 'true');
}

Expand Down
13 changes: 12 additions & 1 deletion components/com_content/views/form/view.html.php
Expand Up @@ -50,9 +50,20 @@ public function display($tpl = null)
$this->form = $this->get('Form');
$this->return_page = $this->get('ReturnPage');

$authorised = false;
Quy marked this conversation as resolved.
Show resolved Hide resolved

if (empty($this->item->id))
{
$authorised = $user->authorise('core.create', 'com_content') || count($user->getAuthorisedCategories('com_content', 'core.create'));
$catid = $this->state->params->get('catid');

if ($this->state->params->get('enable_category') == 1 && $catid)
infograf768 marked this conversation as resolved.
Show resolved Hide resolved
{
$authorised = $user->authorise('core.create', 'com_content.category.' . $catid);
}
else
{
$authorised = $user->authorise('core.create', 'com_content') || count($user->getAuthorisedCategories('com_content', 'core.create'));
}
}
else
{
Expand Down