function securepages_roles in Secure Pages 6.2
Same name and namespace in other branches
- 7 securepages.module \securepages_roles()
Checks if the user is in a role that is always forced onto HTTPS.
Parameters
$account: A valid user object.
Return value
The number of roles set on the user that require HTTPS enforcing.
2 calls to securepages_roles()
- securepages_form_alter in ./
securepages.module - Implements hook_form_alter().
- securepages_redirect in ./
securepages.module - Checks the current page and see if we need to redirect to the secure or insecure version of the page.
3 string references to 'securepages_roles'
- SecurePagesTestCase::_testRoles in ./
securepages.test - Test role-based switching.
- securepages_settings in ./
securepages.admin.inc - Builds the securepages settings form.
- securepages_uninstall in ./
securepages.install - Implements hook_uninstall().
File
- ./
securepages.module, line 216 - Provide method of creating allowing certain pages to only viewable from https pages
Code
function securepages_roles($account) {
// All rids are in the settings, so first we need to filter out the ones
// that aren't enabled. Otherwise this would match positive against all
// roles a user has set.
$roles = array_filter(variable_get('securepages_roles', array()));
$matches = array_intersect_key($account->roles, $roles);
return count($matches);
}