SproutCMS

This is the code documentation for the SproutCMS project

class AdminAuth

Provides user authentication functions for the admin

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-05-04
**/
class NewClassName extends AdminAuth {
    
    /**
    * A super-operator -- has access to everything (dev tools, all permissions, etc)
    **/
    public function isSuper () {
        // Method code goes here
    }
    
    /**
    * Does the record-id for this login correspond to a local database record?
    **/
    public function hasDatabaseRecord () {
        // Method code goes here
    }
    
    /**
    * Get the ID of the 'Primary administrators' category
    * 
    * i.e. the first category with permission to manage operators
    **/
    public function getPrimaryCategoryId () {
        // Method code goes here
    }
    
    /**
    * Gets a list of all of the admin categories
    * Returned as an array of id =&gt; name
    **/
    public function getAllCategories () {
        // Method code goes here
    }
    
    /**
    * Returns true if the currently logged in user is in the specified category.
    * Always returns true for remotely-logged in users.
    **/
    public function inCategory (int $category_id) {
        // Method code goes here
    }
    
    /**
    * Returns an array of all categories the currently logged in operator is in
    **/
    public function getOperatorCategories () {
        // Method code goes here
    }
    
    /**
    * Gets the id, name, username and email of the currently logged in operator.
    * N.B. the id will be 0 for remote users
    **/
    public function getDetails () {
        // Method code goes here
    }
    
    /**
    * Fetches the ID of current operator if and only if they're a local operator, otherwise 0.
    **/
    public function getLocalId () {
        // Method code goes here
    }
    
    /**
    * Logs an operator out
    **/
    public function logout () {
        // Method code goes here
    }
    
    /**
    * Returns the id of the currently logged in operator
    **/
    public function getId () {
        // Method code goes here
    }
    
    /**
    * Store a login attempt (used for rate checking)
    **/
    public function saveLoginAttempt ($username, $ip, $success) {
        // Method code goes here
    }
    
    /**
    * Does a rate-limit check for admin logins against the login_attempts table
    **/
    public function checkRateLimit ($username, $ip) {
        // Method code goes here
    }
    
    /**
    * If the user is not logged, redirect them to a login page
    **/
    public function checkLogin () {
        // Method code goes here
    }
    
    /**
    * Check if the user is logged in or not
    **/
    public function isLoggedIn () {
        // Method code goes here
    }
    
    /**
    * Processes the login by a operator with the specified username and password
    **/
    public function processLogin (string $username, string $password) {
        // Method code goes here
    }
    
    /**
    * Checks the password on the database matches the one provided
    * For re-authenticating certain actions of logged in operators
    **/
    public function checkPassword ($password, $operator_id) {
        // Method code goes here
    }
    
    /**
    * Stub function for future development using OpenID
    **/
    public function processOpenid (string $openid) {
        // Method code goes here
    }
    
    /**
    * Process a local (developer) login, with details stored in a config file
    **/
    public function processLocal (string $username, string $password) {
        // Method code goes here
    }
    
    /**
    * Load the existing super-operators list from config, inject another operator, return new array
    **/
    public function injectLocalSuperConf (string $username, string $pass_hash, string $pass_salt) {
        // Method code goes here
    }
    
    /**
    * Sets the password for a operator, or the current operator if a operator-id is not specified.
    **/
    public function changePassword (string $new_password, int $operator_id) {
        // Method code goes here
    }
    
    /**
    * Process a remote (developer) login, as provided by the external web service
    **/
    public function processRemote (string $username, string $password) {
        // Method code goes here
    }
    
}
?>