add my/permission/checker to business controller

This commit is contained in:
Hesabix 2024-01-25 10:40:47 +00:00
parent 6e08797265
commit 4e4f2e289b
3 changed files with 51 additions and 38 deletions

View file

@ -354,16 +354,16 @@
}, },
{ {
"name": "doctrine/dbal", "name": "doctrine/dbal",
"version": "3.7.2", "version": "3.7.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/dbal.git", "url": "https://github.com/doctrine/dbal.git",
"reference": "0ac3c270590e54910715e9a1a044cc368df282b2" "reference": "ce594cbc39a4866c544f1a970d285ff0548221ad"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/0ac3c270590e54910715e9a1a044cc368df282b2", "url": "https://api.github.com/repos/doctrine/dbal/zipball/ce594cbc39a4866c544f1a970d285ff0548221ad",
"reference": "0ac3c270590e54910715e9a1a044cc368df282b2", "reference": "ce594cbc39a4866c544f1a970d285ff0548221ad",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -379,14 +379,14 @@
"doctrine/coding-standard": "12.0.0", "doctrine/coding-standard": "12.0.0",
"fig/log-test": "^1", "fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2023.1", "jetbrains/phpstorm-stubs": "2023.1",
"phpstan/phpstan": "1.10.42", "phpstan/phpstan": "1.10.56",
"phpstan/phpstan-strict-rules": "^1.5", "phpstan/phpstan-strict-rules": "^1.5",
"phpunit/phpunit": "9.6.13", "phpunit/phpunit": "9.6.15",
"psalm/plugin-phpunit": "0.18.4", "psalm/plugin-phpunit": "0.18.4",
"slevomat/coding-standard": "8.13.1", "slevomat/coding-standard": "8.13.1",
"squizlabs/php_codesniffer": "3.7.2", "squizlabs/php_codesniffer": "3.8.1",
"symfony/cache": "^5.4|^6.0", "symfony/cache": "^5.4|^6.0|^7.0",
"symfony/console": "^4.4|^5.4|^6.0", "symfony/console": "^4.4|^5.4|^6.0|^7.0",
"vimeo/psalm": "4.30.0" "vimeo/psalm": "4.30.0"
}, },
"suggest": { "suggest": {
@ -447,7 +447,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/doctrine/dbal/issues", "issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.7.2" "source": "https://github.com/doctrine/dbal/tree/3.7.3"
}, },
"funding": [ "funding": [
{ {
@ -463,7 +463,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-11-19T08:06:58+00:00" "time": "2024-01-21T07:53:09+00:00"
}, },
{ {
"name": "doctrine/deprecations", "name": "doctrine/deprecations",
@ -1156,16 +1156,16 @@
}, },
{ {
"name": "doctrine/orm", "name": "doctrine/orm",
"version": "2.17.2", "version": "2.17.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/orm.git", "url": "https://github.com/doctrine/orm.git",
"reference": "393679a4795e49b0b3ac317dce84d0f8888f2b77" "reference": "398ab0547aaf90bdb352b560a94c24f44ff00670"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/orm/zipball/393679a4795e49b0b3ac317dce84d0f8888f2b77", "url": "https://api.github.com/repos/doctrine/orm/zipball/398ab0547aaf90bdb352b560a94c24f44ff00670",
"reference": "393679a4795e49b0b3ac317dce84d0f8888f2b77", "reference": "398ab0547aaf90bdb352b560a94c24f44ff00670",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1251,9 +1251,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/doctrine/orm/issues", "issues": "https://github.com/doctrine/orm/issues",
"source": "https://github.com/doctrine/orm/tree/2.17.2" "source": "https://github.com/doctrine/orm/tree/2.17.3"
}, },
"time": "2023-12-20T21:47:52+00:00" "time": "2024-01-16T21:32:04+00:00"
}, },
{ {
"name": "doctrine/persistence", "name": "doctrine/persistence",
@ -9260,16 +9260,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "9.6.15", "version": "9.6.16",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "05017b80304e0eb3f31d90194a563fd53a6021f1" "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/05017b80304e0eb3f31d90194a563fd53a6021f1", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3767b2c56ce02d01e3491046f33466a1ae60a37f",
"reference": "05017b80304e0eb3f31d90194a563fd53a6021f1", "reference": "3767b2c56ce02d01e3491046f33466a1ae60a37f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -9343,7 +9343,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.15" "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.16"
}, },
"funding": [ "funding": [
{ {
@ -9359,7 +9359,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-12-01T16:55:19+00:00" "time": "2024-01-19T07:03:14+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",

View file

@ -334,9 +334,22 @@ class BusinessController extends AbstractController
return $this->json(['result'=>-1]); return $this->json(['result'=>-1]);
} }
#[Route('/api/business/get/user/permissions', name: 'api_business_get_user_permission')] #[Route('/api/business/my/permission/state', name: 'api_business_my_permission_state')]
public function api_business_get_user_permission(Log $log,Request $request,EntityManagerInterface $entityManager): Response public function api_business_my_permission_state(Request $request,Access $access): Response
{ {
$reqdata = json_decode($request->getContent(), true);
if(!array_key_exists('permission',$reqdata)){
throw $this->createNotFoundException();
}
$acc = $access->hasRole($reqdata['permission']);
if($acc)
return $this->json(['state'=>true]);
return $this->json(['state'=>false]);
}
#[Route('/api/business/get/user/permissions', name: 'api_business_get_user_permission')]
public function api_business_get_user_permission(Request $request,EntityManagerInterface $entityManager): Response
{
$params = []; $params = [];
if ($content = $request->getContent()) { if ($content = $request->getContent()) {
$params = json_decode($content, true); $params = json_decode($content, true);

View file

@ -18,11 +18,11 @@ class JsonResp
'type' => $hesabdariDoc->getType(), 'type' => $hesabdariDoc->getType(),
'code' => $hesabdariDoc->getCode(), 'code' => $hesabdariDoc->getCode(),
'des' => $hesabdariDoc->getDes(), 'des' => $hesabdariDoc->getDes(),
'amount'=>$hesabdariDoc->getAmount(), 'amount' => $hesabdariDoc->getAmount(),
'mdate' =>$hesabdariDoc->getMdate(), 'mdate' => $hesabdariDoc->getMdate(),
'plugin'=>$hesabdariDoc->getPlugin(), 'plugin' => $hesabdariDoc->getPlugin(),
'refData'=>$hesabdariDoc->getRefData(), 'refData' => $hesabdariDoc->getRefData(),
'shortLink'=>$hesabdariDoc->getShortlink(), 'shortLink' => $hesabdariDoc->getShortlink(),
'status' => $hesabdariDoc->getStatus(), 'status' => $hesabdariDoc->getStatus(),
'tempStatus' => $hesabdariDoc->getTempStatus(), 'tempStatus' => $hesabdariDoc->getTempStatus(),
]; ];