mcn/user

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.0.1) of this package.

Provides basic user functionality

1.0.1 2013-10-23 08:37 UTC

This package is not auto-updated.

Last update: 2016-03-12 08:35:09 UTC


README

Build Status

Configuration

Copy the file config/mcnuser.global.php.dist to your applications autoload directory. Available configuration options should be documented in that file!

Authentication

Reserved result codes

Failing to comply can lead to unexpected results if you try and use other components

# The range 1 to -10 is reserved for MCNUser
// Constants are from MCNUser\Authentication\Result
const SUCCESS = 1;
const FAILURE_IDENTITY_NOT_FOUND = -1;
const FAILURE_INVALID_CREDENTIAL = -2;
const FAILURE_UNCATEGORIZED      = -3;
const FAILURE_DISABLED_PLUGIN    = -4;

# The range -10 to -30 is reserved for MCN<SocialNetwork> components such as linkedIn or Facebook
// Constants are from MCNLinkedIn\Authentication\Result
const FAILURE_INVALID_CONFIGURATION = -11;
const FAILURE_ACCESS_DENIED         = -12;

Authentication events

// Constants are from MCNUser\Authentication\AuthEvent
const EVENT_LOGOUT       = 'logout';
const EVENT_AUTH_SUCCESS = 'authenticate.success';
const EVENT_AUTH_FAILURE = 'authenticate.failure';

Example usage could be to inject a listener to listen to the authenticate success event and check if the user has confirmed their email account. To do this we must add a user state property to a class that extends the MCNUser\Entity\User

// Example listener could look like this
$authenticationService->getEventManager()->attach(AuthEvent::EVENT_AUTH_SUCCESS, function(Event $e) {

    $user = $e->getResult()->getIdentity();

    if ($user->getState() != User::STATE_CONFIRMED) {

        $e->stopPropagation(true);
        return 'Your email has not yet been confirmed';
    }
});