<acpmenuitem name="wcf.acp.menu.link.article.list">
<controller>wcf\acp\page\ArticleListPage</controller>
<parent>wcf.acp.menu.link.article</parent>
- <permissions>admin.content.article.canManageArticle</permissions>
+ <permissions>admin.content.article.canManageArticle,admin.content.article.canContributeArticle</permissions>
</acpmenuitem>
<acpmenuitem name="wcf.acp.menu.link.article.add">
<controller>wcf\acp\form\ArticleAddForm</controller>
<parent>wcf.acp.menu.link.article.list</parent>
- <permissions>admin.content.article.canManageArticle</permissions>
+ <permissions>admin.content.article.canManageArticle,admin.content.article.canContributeArticle</permissions>
<icon>fa-plus</icon>
</acpmenuitem>
<admindefaultvalue>1</admindefaultvalue>
<usersonly>1</usersonly>
</option>
+ <option name="admin.content.article.canContributeArticle">
+ <categoryname>admin.content</categoryname>
+ <optiontype>boolean</optiontype>
+ <defaultvalue>0</defaultvalue>
+ <admindefaultvalue>1</admindefaultvalue>
+ <usersonly>1</usersonly>
+ </option>
<option name="admin.content.article.canManageCategory">
<categoryname>admin.content</categoryname>
<optiontype>boolean</optiontype>
{include file='header' pageTitle='wcf.acp.article.'|concat:$action}
-<script data-relocate="true">
- $(function() {
- $('input[type="radio"][name="publicationStatus"]').change(function(event) {
- var $selected = $('input[type="radio"][name="publicationStatus"]:checked');
- if ($selected.length > 0) {
- if ($selected.val() == 2) {
- $('#publicationDateDl').show();
- }
- else {
- $('#publicationDateDl').hide();
+{if $__wcf->session->getPermission('admin.content.article.canManageArticle')}
+ <script data-relocate="true">
+ $(function() {
+ $('input[type="radio"][name="publicationStatus"]').change(function(event) {
+ var $selected = $('input[type="radio"][name="publicationStatus"]:checked');
+ if ($selected.length > 0) {
+ if ($selected.val() == 2) {
+ $('#publicationDateDl').show();
+ }
+ else {
+ $('#publicationDateDl').hide();
+ }
}
- }
- }).trigger('change');
- });
-</script>
+ }).trigger('change');
+ });
+ </script>
+{/if}
<script data-relocate="true">
require(['WoltLabSuite/Core/Ui/User/Search/Input'], function(UiUserSearchInput) {
</dd>
</dl>
- <dl>
- <dt><label for="categoryID">{lang}wcf.acp.article.publicationStatus{/lang}</label></dt>
- <dd class="floated">
- <label><input type="radio" name="publicationStatus" value="0"{if $publicationStatus == 0} checked{/if}> {lang}wcf.acp.article.publicationStatus.unpublished{/lang}</label>
- <label><input type="radio" name="publicationStatus" value="1"{if $publicationStatus == 1} checked{/if}> {lang}wcf.acp.article.publicationStatus.published{/lang}</label>
- <label><input type="radio" name="publicationStatus" value="2"{if $publicationStatus == 2} checked{/if}> {lang}wcf.acp.article.publicationStatus.delayed{/lang}</label>
- </dd>
- </dl>
-
- <dl id="publicationDateDl"{if $errorField == 'publicationDate'} class="formError"{/if}{if $publicationStatus != 2} style="display: none"{/if}>
- <dt><label for="publicationDate">{lang}wcf.acp.article.publicationDate{/lang}</label></dt>
- <dd>
- <input type="datetime" id="publicationDate" name="publicationDate" value="{$publicationDate}" class="medium">
- {if $errorField == 'publicationDate'}
- <small class="innerError">
- {if $errorType == 'empty'}
- {lang}wcf.global.form.error.empty{/lang}
- {else}
- {lang}wcf.acp.article.publicationDate.error.{@$errorType}{/lang}
- {/if}
- </small>
- {/if}
- </dd>
- </dl>
+ {if $__wcf->session->getPermission('admin.content.article.canManageArticle')}
+ <dl>
+ <dt><label for="categoryID">{lang}wcf.acp.article.publicationStatus{/lang}</label></dt>
+ <dd class="floated">
+ <label><input type="radio" name="publicationStatus" value="0"{if $publicationStatus == 0} checked{/if}> {lang}wcf.acp.article.publicationStatus.unpublished{/lang}</label>
+ <label><input type="radio" name="publicationStatus" value="1"{if $publicationStatus == 1} checked{/if}> {lang}wcf.acp.article.publicationStatus.published{/lang}</label>
+ <label><input type="radio" name="publicationStatus" value="2"{if $publicationStatus == 2} checked{/if}> {lang}wcf.acp.article.publicationStatus.delayed{/lang}</label>
+ </dd>
+ </dl>
+
+ <dl id="publicationDateDl"{if $errorField == 'publicationDate'} class="formError"{/if}{if $publicationStatus != 2} style="display: none"{/if}>
+ <dt><label for="publicationDate">{lang}wcf.acp.article.publicationDate{/lang}</label></dt>
+ <dd>
+ <input type="datetime" id="publicationDate" name="publicationDate" value="{$publicationDate}" class="medium">
+ {if $errorField == 'publicationDate'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.article.publicationDate.error.{@$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+ {/if}
<dl>
<dt></dt>
/**
* @inheritDoc
*/
- public $neededPermissions = ['admin.content.article.canManageArticle'];
+ public $neededPermissions = ['admin.content.article.canManageArticle', 'admin.content.article.canContributeArticle'];
/**
* true if created article is multi-lingual
$this->timeObj = \DateTime::createFromFormat('Y-m-d\TH:i:sP', $this->time);
}
if (!empty($_POST['enableComments'])) $this->enableComments = 1;
- if (isset($_POST['publicationStatus'])) $this->publicationStatus = intval($_POST['publicationStatus']);
+
+ if (WCF::getSession()->getPermission('admin.content.article.canManageArticle')) {
+ if (isset($_POST['publicationStatus'])) $this->publicationStatus = intval($_POST['publicationStatus']);
+ }
+ else {
+ $this->publicationStatus = Article::UNPUBLISHED;
+ }
+
if ($this->publicationStatus == Article::DELAYED_PUBLICATION && isset($_POST['publicationDate'])) {
$this->publicationDate = $_POST['publicationDate'];
$this->publicationDateObj = \DateTime::createFromFormat('Y-m-d\TH:i:sP', $this->publicationDate);
$dateTime = DateUtil::getDateTimeByTimestamp(TIME_NOW);
$dateTime->setTimezone(WCF::getUser()->getTimeZone());
$this->time = $dateTime->format('c');
+
+ if (!WCF::getSession()->getPermission('admin.content.article.canManageArticle')) {
+ $this->publicationStatus = Article::UNPUBLISHED;
+ }
}
/**
use wcf\data\article\ArticleAction;
use wcf\form\AbstractForm;
use wcf\system\exception\IllegalLinkException;
+use wcf\system\exception\PermissionDeniedException;
use wcf\system\language\LanguageFactory;
use wcf\system\tagging\TagEngine;
use wcf\system\WCF;
throw new IllegalLinkException();
}
if ($this->article->isMultilingual) $this->isMultilingual = 1;
+
+ if (!WCF::getSession()->getPermission('admin.content.article.canManageArticle')) {
+ if ($this->article->userID != WCF::getUser()->userID || $this->article->publicationStatus != Article::UNPUBLISHED) {
+ throw new PermissionDeniedException();
+ }
+ }
}
/**
<?php
namespace wcf\acp\page;
+use wcf\data\article\Article;
use wcf\data\article\ArticleList;
use wcf\data\article\ViewableArticleList;
use wcf\data\category\CategoryNodeTree;
/**
* @inheritDoc
*/
- public $neededPermissions = ['admin.content.article.canManageArticle'];
+ public $neededPermissions = ['admin.content.article.canManageArticle', 'admin.content.article.canContributeArticle'];
/**
* @inheritDoc
if (!empty($this->content)) {
$this->objectList->getConditionBuilder()->add('article.articleID IN (SELECT articleID FROM wcf'.WCF_N.'_article_content WHERE content LIKE ?)', ['%'.$this->content.'%']);
}
+ if (!WCF::getSession()->getPermission('admin.content.article.canManageArticle')) {
+ // only show own articles
+ $this->objectList->getConditionBuilder()->add('article.userID = ?', [WCF::getUser()->userID]);
+ $this->objectList->getConditionBuilder()->add('article.publicationStatus = ?', [Article::UNPUBLISHED]);
+ }
$this->objectList->sqlSelects = "(SELECT title FROM wcf".WCF_N."_article_content WHERE articleID = article.articleID AND (languageID IS NULL OR languageID = ".WCF::getLanguage()->languageID.") LIMIT 1) AS title";
}
* @return boolean
*/
public function canRead() {
+ if ($this->publicationStatus != Article::PUBLISHED) {
+ if (!WCF::getSession()->getPermission('admin.content.article.canManageArticle') && (!WCF::getSession()->getPermission('admin.content.article.canContributeArticle') || $this->userID != WCF::getUser()->userID)) {
+ return false;
+ }
+ }
+
if ($this->getCategory()) {
return $this->getCategory()->isAccessible();
}
<item name="wcf.acp.group.option.user.tag.canViewTag"><![CDATA[Kann Tag sehen]]></item>
<item name="wcf.acp.group.option.category.user.cms"><![CDATA[CMS]]></item>
<item name="wcf.acp.group.option.admin.content.article.canManageArticle"><![CDATA[Kann Artikel verwalten]]></item>
+ <item name="wcf.acp.group.option.admin.content.article.canContributeArticle"><![CDATA[Kann Artikel einreichen]]></item>
<item name="wcf.acp.group.option.admin.content.article.canManageCategory"><![CDATA[Kann Artikel-Kategorien verwalten]]></item>
<item name="wcf.acp.group.option.admin.content.cms.canManageBox"><![CDATA[Kann Boxen verwalten]]></item>
<item name="wcf.acp.group.option.admin.content.cms.canManageMedia"><![CDATA[Kann Medien verwalten]]></item>
<item name="wcf.acp.group.option.user.tag.canViewTag"><![CDATA[Can view tags]]></item>
<item name="wcf.acp.group.option.category.user.cms"><![CDATA[CMS]]></item>
<item name="wcf.acp.group.option.admin.content.article.canManageArticle"><![CDATA[Can manage articles]]></item>
+ <item name="wcf.acp.group.option.admin.content.article.canContributeArticle"><![CDATA[Can contribute articles]]></item>
<item name="wcf.acp.group.option.admin.content.article.canManageCategory"><![CDATA[Can manage article categories]]></item>
<item name="wcf.acp.group.option.admin.content.cms.canManageBox"><![CDATA[Can manage boxes]]></item>
<item name="wcf.acp.group.option.admin.content.cms.canManageMedia"><![CDATA[Can manage media]]></item>