Skip to content
Snippets Groups Projects

Issue-getid3-3489129/3489129-create-a-new: Added custom permission

Closed Dhruv Mittal requested to merge issue/getid3-3489129:3489129-create-a-new into 8.x-1.x
4 files
+ 13
1
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -5,6 +5,7 @@ namespace Drupal\getid3\Form;
use Drupal\Component\Utility\Html;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Exception\AccessDeniedHttpException;
/**
* Form builder for the GetId3 settings form.
@@ -33,6 +34,10 @@ class GetId3ConfigForm extends ConfigFormBase {
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
if (!\Drupal::currentUser()->hasPermission('access getid3 configuration')) {
throw new AccessDeniedHttpException();
}
$path = getid3_get_path();
$form['getid3_path'] = [
'#type' => 'textfield',
Loading