public function checkAuthorisation($object, $functionName)
    {
        // Check whether the user has authenticated.
        if ($this->isAuthenticated()) {
            // The user is authenticated. Proceed.
            $class = $object;
            if (is_object($class)) {
                $class = get_class($class);
            }

         Logger::get()->debug("Checking authorisation for {$class}:{$functionName}...");

            // Check that at least one condition is valid.
            if (!(
                // User has total authorisation.
                in_array('*', $this->permissions)
                // User has total class authorisation for this class.
                || @$this->permissions[$class]['*']
                // User has authorisation for this function in this class.
                || @$this->permissions[$class][$functionName]
            )) {
                // User has no authorisation.
                throw new NotAuthorisedException("The current user does not have permission for '{$class}.{$functionName}'.");
            }

         Logger::get()->debug('Authorised.');
        } else {
            // The user is not authenticated.
            throw new NotAuthenticatedException('There is no current authenticated user.');
        }
    }