Checking for a role or a permission in a context

There are two very useful methods to check for certain security settings offered by the Plone API. First, to check if a user has a certain role, the following snippet can be used:

roles_user_has = portal_membership.getCandidateLocalRoles(here)

To check if a user has a certain permission, this API method can be used:

portal_membership.checkPermission('Manage portal', here)

Comments