You are here

function _answers_enable_permissions in Answers 7.4

Enable answers default permissions.

1 call to _answers_enable_permissions()
answers_install in ./answers.install
Implements hook_install().

File

./answers.install, line 87
Install, update, and uninstall functions for the answers module.

Code

function _answers_enable_permissions() {
  $role_perm = array(
    'authenticated user' => array(
      'create answers_question content',
      'edit own answers_question content',
      'create answers_answer content',
      'edit own answers_answer content',
    ),
    'administrator' => array(
      'create answers_question content',
      'edit own answers_question content',
      'edit any answers_question content',
      'delete own answers_question content',
      'delete any answers_question content',
      'create answers_answer content',
      'edit own answers_answer content',
      'edit any answers_answer content',
      'delete own answers_answer content',
      'delete any answers_answer content',
    ),
  );
  foreach ($role_perm as $role_name => $permissions) {
    $role = user_role_load_by_name($role_name);
    if ($role) {
      user_role_grant_permissions($role->rid, $permissions);
    }
  }
}