|
@@ -701,7 +701,7 @@ class WebController extends Controller
|
|
|
$data['deleteForm'] = $deleteForm->createView();
|
|
|
}
|
|
|
if ($this->getUser() && (
|
|
|
- $this->get('security.authorization_checker')->isGranted('ROLE_DELETE_PACKAGES')
|
|
|
+ $this->isGranted('ROLE_DELETE_PACKAGES')
|
|
|
|| $package->getMaintainers()->contains($this->getUser())
|
|
|
)) {
|
|
|
$data['deleteVersionCsrfToken'] = $this->get('security.csrf.token_manager')->getToken('delete_version');
|
|
@@ -805,7 +805,7 @@ class WebController extends Controller
|
|
|
$version = $repo->getFullVersion($versionId);
|
|
|
$package = $version->getPackage();
|
|
|
|
|
|
- if (!$package->getMaintainers()->contains($this->getUser()) && !$this->get('security.authorization_checker')->isGranted('ROLE_DELETE_PACKAGES')) {
|
|
|
+ if (!$package->getMaintainers()->contains($this->getUser()) && !$this->isGranted('ROLE_DELETE_PACKAGES')) {
|
|
|
throw new AccessDeniedException;
|
|
|
}
|
|
|
|
|
@@ -859,7 +859,7 @@ class WebController extends Controller
|
|
|
return new Response(json_encode(array('status' => 'error', 'message' => 'Invalid credentials',)), 403);
|
|
|
}
|
|
|
|
|
|
- if ($package->getMaintainers()->contains($user) || $this->get('security.authorization_checker')->isGranted('ROLE_UPDATE_PACKAGES')) {
|
|
|
+ if ($package->getMaintainers()->contains($user) || $this->isGranted('ROLE_UPDATE_PACKAGES')) {
|
|
|
$req->getSession()->save();
|
|
|
|
|
|
if (null !== $autoUpdated) {
|
|
@@ -1171,7 +1171,7 @@ class WebController extends Controller
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if ($this->get('security.authorization_checker')->isGranted('ROLE_EDIT_PACKAGES') || $package->getMaintainers()->contains($user)) {
|
|
|
+ if ($this->isGranted('ROLE_EDIT_PACKAGES') || $package->getMaintainers()->contains($user)) {
|
|
|
$maintainerRequest = new MaintainerRequest;
|
|
|
return $this->createForm(new AddMaintainerRequestType, $maintainerRequest);
|
|
|
}
|
|
@@ -1183,7 +1183,7 @@ class WebController extends Controller
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if ($this->get('security.authorization_checker')->isGranted('ROLE_EDIT_PACKAGES') || $package->getMaintainers()->contains($user)) {
|
|
|
+ if ($this->isGranted('ROLE_EDIT_PACKAGES') || $package->getMaintainers()->contains($user)) {
|
|
|
$maintainerRequest = new MaintainerRequest;
|
|
|
return $this->createForm(new RemoveMaintainerRequestType(), $maintainerRequest, array('package'=>$package, 'excludeUser'=>$user));
|
|
|
}
|
|
@@ -1196,7 +1196,7 @@ class WebController extends Controller
|
|
|
}
|
|
|
|
|
|
// super admins bypass additional checks
|
|
|
- if (!$this->get('security.authorization_checker')->isGranted('ROLE_DELETE_PACKAGES')) {
|
|
|
+ if (!$this->isGranted('ROLE_DELETE_PACKAGES')) {
|
|
|
// non maintainers can not delete
|
|
|
if (!$package->getMaintainers()->contains($user)) {
|
|
|
return;
|