Skip to content

Commit

Permalink
minor #3356 [Doc] Built-in action permission method fix + typo (thoma…
Browse files Browse the repository at this point in the history
…s-l)

This PR was merged into the 3.0.x-dev branch.

Discussion
----------

[Doc] Built-in action permission method fix + typo

`->setPermission()` is not available for `Action`, and there is a more simpler method available.

Commits
-------

1cb2942 Built-in action permission method fix + typo
  • Loading branch information
javiereguiluz committed Jun 22, 2020
2 parents abf0b94 + 1cb2942 commit 967cf82
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions doc/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ see the action link/button::
// ...
->add(viewInvoice)

// use the 'update()' method to set the permission of built-in actions
->update(Crud::PAGE_DETAIL, Action::NEW, function (Action $action) {
return $action->setPermission('ROLE_ADMIN');
})
// use the 'setPermission()' method to set the permission of built-in actions
->setPermission(Action::NEW, 'ROLE_ADMIN')
;
}

Expand All @@ -142,7 +140,7 @@ the ``setPermission()`` method::
IntegerField::new('stock'),
// users must have this permission/role to see this field
IntegerField::new('sales')->setPermission('ROLE_ADMIN'),
FloatField::new('comission')->setPermission('ROLE_FINANCE'),
FloatField::new('commission')->setPermission('ROLE_FINANCE'),
// ...
];
}
Expand Down

0 comments on commit 967cf82

Please sign in to comment.