You are here

function hook_group_permission in Group 7

Define group permissions.

This hook can supply permissions that the module defines, so that they can be selected on the group permissions page and used to grant or restrict access to actions the module performs.

Permissions are checked using Group::userHasPermission().

Return value

array An array whose keys are permission names and whose corresponding values are arrays containing the following key-value pairs:

  • title: The human-readable name of the permission, to be shown on the permission administration page. This should be wrapped in the t() function so it can be translated.
  • description: (optional) A description of what the permission does. This should be wrapped in the t() function so it can be translated.
  • restrict access: (optional) A boolean which can be set to TRUE to indicate that site administrators should restrict access to this permission to trusted users. This should be used for permissions that have inherent security risks across a variety of potential use cases (for example, the "administer filters" and "bypass node access" permissions provided by Drupal core). When set to TRUE, a standard warning message defined in user_admin_permissions() and output via theme_user_permission_description() will be associated with the permission and displayed with it on the permission administration page. Defaults to FALSE.
  • warning: (optional) A translated warning message to display for this permission on the permission administration page. This warning overrides the automatic warning generated by 'restrict access' being set to TRUE. This should rarely be used, since it is important for all permissions to have a clear, consistent security warning that is the same across the site. Use the 'description' key instead to provide any information that is specific to the permission you are defining.
  • limit to: (optional) A bit flag to define which membership types can use this permission. Possible flags are GROUP_LIMIT_ANONYMOUS, GROUP_LIMIT_OUTSIDER and GROUP_LIMIT_MEMBER. Defaults to GROUP_LIMIT_ALL which allows the permission to be set for any type of membership.

See also

hook_permission()

6 functions implement hook_group_permission()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

gadd_group_permission in modules/gadd/gadd.group.inc
Implements hook_group_permission().
ggroup_group_permission in modules/ggroup/ggroup.group.inc
Implements hook_group_permission().
ginvite_group_permission in modules/ginvite/ginvite.group.inc
Implements hook_group_permission().
gprofile_group_permission in modules/gprofile/gprofile.group.inc
Implements hook_group_permission().
group_group_permission in ./group.group.inc
Implements hook_group_permission().

... See full list

5 invocations of hook_group_permission()
group_group_permission_access_settings in plugins/ctools/access/group_permission.inc
Settings form for the group role access plugin.
group_group_permission_access_summary in plugins/ctools/access/group_permission.inc
Provide a summary description based upon the checked roles.
group_install in ./group.install
Implements hook_install().
group_permissions in helpers/group.inc
Return the possible group permissions.
group_permission_form in admin/group.permission.inc
Builds the role permission page.

File

./group.api.php, line 101
Hooks provided by the Group module.

Code

function hook_group_permission() {
  return array(
    'contact group members' => array(
      'title' => t('Contact group members'),
      'description' => t('Send group members a private message.'),
    ),
  );
}