BEdita API doc | 4-cactus
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Download

Namespaces

  • BEdita
    • API
      • Auth
      • Controller
        • Admin
        • Component
        • Model
      • Error
      • Event
      • Exception
      • Middleware
      • Model
        • Action
      • Network
        • Exception
      • Shell
      • TestSuite
      • Utility
    • Core
      • Configure
        • Engine
      • Database
        • Type
      • Exception
      • Filesystem
        • Adapter
        • Exception
        • Thumbnail
      • I18n
      • Job
        • Service
      • Mailer
        • Preview
        • Transport
      • Model
        • Action
        • Behavior
        • Entity
        • Table
        • Validation
      • ORM
        • Inheritance
        • Locator
        • Rule
      • Shell
        • Task
      • State
      • TestSuite
        • Fixture
      • Utility

Classes

  • AddAssociatedAction
  • AddRelatedObjectsAction
  • BaseAction
  • ChangeCredentialsAction
  • ChangeCredentialsRequestAction
  • DeleteEntityAction
  • DeleteObjectAction
  • GetEntityAction
  • GetObjectAction
  • ListEntitiesAction
  • ListObjectsAction
  • ListRelatedFoldersAction
  • RemoveAssociatedAction
  • RemoveRelatedObjectsAction
  • SaveEntityAction
  • SetAssociatedAction
  • SetRelatedObjectsAction
  • SignupUserAction
  • SignupUserActivationAction
  • UpdateAssociatedAction

Class SignupUserAction

Command to signup a user.

BEdita\Core\Model\Action\BaseAction uses Cake\Core\InstanceConfigTrait (not available)
Extended by BEdita\Core\Model\Action\SignupUserAction implements Cake\Event\EventListenerInterface uses Cake\Event\EventDispatcherTrait (not available) Cake\Mailer\MailerAwareTrait (not available)
Namespace: BEdita\Core\Model\Action
Since: 4.0.0
Located at Core/src/Model/Action/SignupUserAction.php

Methods summary

protected
# initialize( array $config )

Command initialization.

Command initialization.

Parameters

$config
Configuration.

Overrides

BEdita\Core\Model\Action\BaseAction::initialize
public BEdita\Core\Model\Entity\User
# execute( array $data = [] )

Command execution.

Command execution.

Parameters

$data
Data.

Returns

BEdita\Core\Model\Entity\User

Throws

Cake\Http\Exception\BadRequestException
When validation of URL options fails
Cake\Http\Exception\UnauthorizedException
Upon external authorization check failure.
protected array
# normalizeInput( array $data )

Normalize input data to plain JSON if in JSON API format

Normalize input data to plain JSON if in JSON API format

Parameters

$data
Input data

Returns

array
Normalized array
protected array
# validate( array $data )

Validate data.

Validate data.

It needs to validate some data that don't concern the User entity as activation_url and redirect_url

Parameters

$data
The data to validate

Returns

array
public true|string
# validateRoles( string|array $roles )

Validate roles against allowed signup roles configured. In addtion roles can't contain ADMIN_ROLE.

Validate roles against allowed signup roles configured. In addtion roles can't contain ADMIN_ROLE.

Parameters

$roles
The roles to check

Returns

true|string
protected BEdita\Core\Model\Entity\User|boolean
# createUser( array $data )

Create a new user with status: - on if an external auth provider is used or no activation is required via requireActivation config - draft in other cases.

Create a new user with status: - on if an external auth provider is used or no activation is required via requireActivation config - draft in other cases.

The user is validated using 'signup' validation.

Parameters

$data
The data to save

Returns

BEdita\Core\Model\Entity\User|boolean
User created or false on error

Throws

Cake\Http\Exception\UnauthorizedException
Upon external authorization check failure.
protected @return
# createUserEntity( array $data, string $status, string $validate )

Create User model entity.

Create User model entity.

Parameters

$data
The signup data
$status
User status, on or draft
$validate
Validation options to use

Returns

@return
\BEdita\Core\Model\Entity\User The User entity created
protected BEdita\Core\Model\Entity\AuthProvider
# checkExternalAuth( array $data )

Check external auth data validity

Check external auth data validity

To perform external auth check these fields are mandatory: - "auth_provider": provider name like "google", "facebook"... must be in auth_providers - "provider_username": id or username of the provider - "access_token": token returned by provider to use in check

Parameters

$data
The signup data

Returns

BEdita\Core\Model\Entity\AuthProvider
AuthProvider entity

Throws

Cake\Http\Exception\UnauthorizedException
Upon external authorization check failure.
protected array
# getOAuth2Response( string $url, string $accessToken )

Get response from an OAuth2 provider

Get response from an OAuth2 provider

Parameters

$url
OAuth2 provider URL
$accessToken
Access token to use in request

Returns

array
Response from an OAuth2 provider

Codecoverageignore

protected
# addRoles( BEdita\Core\Model\Entity\User $entity, array $data )

Add roles to user if requested, with validity check

Add roles to user if requested, with validity check

Parameters

$entity
The user created
$data
The signup data
protected BEdita\Core\Model\Entity\Role[]
# loadRoles( array $roles )

Load requested roles.

Load requested roles.

Parameters

$roles
Requested role names

Returns

BEdita\Core\Model\Entity\Role[]
requested role entities
protected BEdita\Core\Model\Entity\AsyncJob
# createSignupJob( BEdita\Core\Model\Entity\User $user )

Create the signup async job

Create the signup async job

Parameters

$user
The user created

Returns

BEdita\Core\Model\Entity\AsyncJob
public
# sendMail( Cake\Event\Event $event, BEdita\Core\Model\Entity\User $user, BEdita\Core\Model\Entity\AsyncJob $job, string $activationUrl )

Send confirmation email to user

Send confirmation email to user

Parameters

$event
Dispatched event.
$user
The user
$job
The referred async job
$activationUrl
URL to be used for activation.
public
# sendActivationMail( Cake\Event\Event $event, BEdita\Core\Model\Entity\User $user )

Send welcome email to user to inform of successfully activation External auth users are already activated

Send welcome email to user to inform of successfully activation External auth users are already activated

Parameters

$event
Dispatched event.
$user
The user
protected string
# getActivationUrl( BEdita\Core\Model\Entity\AsyncJob $job, array $urlOptions )

Return the signup activation url

Return the signup activation url

Parameters

$job
The async job entity
$urlOptions
The options used to build activation url

Returns

string
public
# implementedEvents( )

Methods inherited from BEdita\Core\Model\Action\BaseAction

__construct(), __invoke()

Constants summary

string BE_USER_EXISTS

400 Username already registered

400 Username already registered

# 'be_user_exists'

Properties summary

protected BEdita\Core\Model\Table\UsersTable $Users

The UsersTable table

The UsersTable table

#
protected BEdita\Core\Model\Table\AsyncJobsTable $AsyncJobs

The AsyncJobs table

The AsyncJobs table

#
protected BEdita\Core\Model\Table\RolesTable $Roles

The RolesTable table

The RolesTable table

#
protected array $_defaultConfig

Default configuration.

Default configuration.

  • activation_url => url used for signup activation
  • roles => the allowed roles on signup. if empty no role can be associated
  • defaultRoles => default roles associated to user if no one was specified
  • requireActivation => false if user will be active without confirm
# [ 'activation_url' => null, 'roles' => null, 'defaultRoles' => null, 'requireActivation' => true, ]
BEdita API doc | 4-cactus API documentation generated by ApiGen