Skip to content

midcom.services.auth

flack edited this page Dec 8, 2016 · 5 revisions

This class holds methods which help dealing with authentication and ACL handling. They can be acessed from elements via the static midcom accessor in the following form:

midcom::get()->auth->require_valid_user();
midcom::get()->auth->can_do('midgard:create', $object);

MidCOM uses a system of privileges which are defined in midcom_core_privilege. These may be checked or changed with various methods.

Available Methods

  • can_do
  • can_user_do
  • drop_sudo
  • get_assignee
  • get_default_privileges
  • get_group - expects an ID and returns a midcom_core_group object
  • get_midgard_group_by_name expects a name and returns a midcom_core_group Object
  • get_privileges
  • get_user - requires a valid ID or GUID and returns a midcom_core_user object
  • get_user_by_name - requires a valid username and returns a midcom_core_user object
  • is_group_member - requires a midcom_core_group object or a string identifying the Group and optionally a midcom_core_user object
  • is_valid_user
  • logout
  • request_sudo
  • require_admin_user - checks if the currently logged-in user has admin privileges and displays a login box if s/he hasn't
  • require_do
  • require_group_member
  • require_user_do
  • require_valid_user
  • show_login_form
  • show_login_page
Clone this wiki locally