CodeIgniter Authentication Helper

This helper provides the functions related to user authentication and authorization. The following features are supported by authentication helper together with user controller.

Functions

  • isLoggedIn() Returns TRUE is user is logged in the website, else FALSE;
  • isNotLoggedIn() Returns TRUE if user not logged in and FALSE otherwise.
  • getUsername() Returns the username of the logged in user. Returns FALSE, if user is not logged in.
  • getNameByUserId($userid) Returns the name of the user for the given user id.
  • getName() Returns the name of the logged in user.
  • hasAccess($permission_name) Return TRUE, if the logged in user has the given permission else FALSE.
  • hasNoAccess($permission_name) Negative of hasAccess($permission_name)
  • hasRole($role_name) Returns TRUE if the logged user has the given Role else returns FALSE.
  • getUserRecord() Returns the all the details of the logged in user.