mirror of
https://github.com/Karaka-Management/oms-News.git
synced 2026-02-18 09:28:41 +00:00
changed badly named permission type to permission category because type should only be read/write/...
This commit is contained in:
parent
63db673b58
commit
5648466054
|
|
@ -13,7 +13,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Modules\News\Controller\ApiController;
|
use Modules\News\Controller\ApiController;
|
||||||
use Modules\News\Models\PermissionState;
|
use Modules\News\Models\PermissionCategory;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Router\RouteVerb;
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => ApiController::NAME,
|
'module' => ApiController::NAME,
|
||||||
'type' => PermissionType::CREATE,
|
'type' => PermissionType::CREATE,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -34,7 +34,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => ApiController::NAME,
|
'module' => ApiController::NAME,
|
||||||
'type' => PermissionType::MODIFY,
|
'type' => PermissionType::MODIFY,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -43,7 +43,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => ApiController::NAME,
|
'module' => ApiController::NAME,
|
||||||
'type' => PermissionType::READ,
|
'type' => PermissionType::READ,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -52,7 +52,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => ApiController::NAME,
|
'module' => ApiController::NAME,
|
||||||
'type' => PermissionType::DELETE,
|
'type' => PermissionType::DELETE,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Modules\News\Controller\BackendController;
|
use Modules\News\Controller\BackendController;
|
||||||
use Modules\News\Models\PermissionState;
|
use Modules\News\Models\PermissionCategory;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Router\RouteVerb;
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::READ,
|
'type' => PermissionType::READ,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
@ -36,7 +36,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::READ,
|
'type' => PermissionType::READ,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
@ -47,7 +47,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::READ,
|
'type' => PermissionType::READ,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
@ -58,7 +58,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::MODIFY,
|
'type' => PermissionType::MODIFY,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
@ -69,7 +69,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::CREATE,
|
'type' => PermissionType::CREATE,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
@ -80,7 +80,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::MODIFY,
|
'type' => PermissionType::MODIFY,
|
||||||
'state' => PermissionState::NEWS,
|
'state' => PermissionCategory::NEWS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
@ -91,7 +91,7 @@ return [
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
'type' => PermissionType::MODIFY,
|
'type' => PermissionType::MODIFY,
|
||||||
'state' => PermissionState::ANALYSIS,
|
'state' => PermissionCategory::ANALYSIS,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ use Modules\News\Models\NewsSeen;
|
||||||
use Modules\News\Models\NewsSeenMapper;
|
use Modules\News\Models\NewsSeenMapper;
|
||||||
use Modules\News\Models\NewsStatus;
|
use Modules\News\Models\NewsStatus;
|
||||||
use Modules\News\Models\NullNewsSeen;
|
use Modules\News\Models\NullNewsSeen;
|
||||||
use Modules\News\Models\PermissionState;
|
use Modules\News\Models\PermissionCategory;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Contract\RenderableInterface;
|
use phpOMS\Contract\RenderableInterface;
|
||||||
use phpOMS\DataStorage\Database\Query\OrderType;
|
use phpOMS\DataStorage\Database\Query\OrderType;
|
||||||
|
|
@ -164,7 +164,7 @@ final class BackendController extends Controller implements DashboardElementInte
|
||||||
|
|
||||||
if ($article->createdBy->getId() !== $accountId
|
if ($article->createdBy->getId() !== $accountId
|
||||||
&& !$this->app->accountManager->get($accountId)->hasPermission(
|
&& !$this->app->accountManager->get($accountId)->hasPermission(
|
||||||
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::NEWS, $article->getId())
|
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::NEWS, $article->getId())
|
||||||
) {
|
) {
|
||||||
$view->setTemplate('/Web/Backend/Error/403_inline');
|
$view->setTemplate('/Web/Backend/Error/403_inline');
|
||||||
$response->header->status = RequestStatusCode::R_403;
|
$response->header->status = RequestStatusCode::R_403;
|
||||||
|
|
@ -189,7 +189,7 @@ final class BackendController extends Controller implements DashboardElementInte
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000601001, $request, $response));
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000601001, $request, $response));
|
||||||
$view->addData('news', $article);
|
$view->addData('news', $article);
|
||||||
$view->addData('editable', $this->app->accountManager->get($accountId)->hasPermission(
|
$view->addData('editable', $this->app->accountManager->get($accountId)->hasPermission(
|
||||||
PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::NAME, PermissionState::NEWS, $article->getId())
|
PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::NEWS, $article->getId())
|
||||||
);
|
);
|
||||||
|
|
||||||
// allow comments
|
// allow comments
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ use phpOMS\Stdlib\Base\Enum;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
abstract class PermissionState extends Enum
|
abstract class PermissionCategory extends Enum
|
||||||
{
|
{
|
||||||
public const NEWS = 1;
|
public const NEWS = 1;
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user