function user_perm

6.x user.module user_perm()
4.x user.module user_perm()
5.x user.module user_perm()

File

modules/user/user.module, line 1288

Code

function user_perm() {

  $perms = array(
    "can_edit_user_roles" => array(
      "title" => t("Edit user roles"),
      "description" => t("The user may add/edit/delete user roles in the system."),
    ),
    "can_edit_permissions" => array(
      "title" => t("Edit permissions"),
      "description" => t("The user may assign permissions to different roles in the system."),
      "admin_restricted" => TRUE, // means only appears for admin (user_id == 1)
    ),
    "manage_users" => array(
      "title" => t("Manage users"),
      "description" => t("This is a powerful permission!  It allows the user to edit the details
                          of other users, as well as create users."),
    ),
    "delete_users" => array(
      "title" => t("Delete users"),
      "description" => t("This is a powerful permission!  It allows the user delete users from the system."),
      "admin_restricted" => TRUE, // means only appears for admin (user_id == 1)
    ),
    "change_own_password" => array(
      "title" => t("Change own password?"),
      "description" => t("Check this if the user is allowed to change their own password (from their profile page)."),
    ),
    "change_own_image" => array(
      "title" => t("Change own image?"),
      "description" => t("This lets the user change their own image URL.  In general, leave this disabled if images are programmed to come from another source."),
    ),
  );


  $attributes = user_get_registered_attributes();


  foreach ($attributes as $attr => $definition) {
    $perms ['view_attribute_' . $attr] = array(
      'title' => t("View attribute %attr", array("%attr" => $definition ['title'])),
      'description' => t("Check this is the user should be able to view this attribute. (Ex: on student profile page)."),
    );
    $perms ['edit_attribute_' . $attr] = array(
      'title' => t("Edit attribute %attr", array("%attr" => $definition ['title'])),
      'description' => t("Check this is the user should be able to edit this attribute. (Ex: on student profile page).  You <strong>must</strong> also
                            select the View permission above for this attribute."),
    );
  }


  return $perms;
}