public function createUser($input)
{
$validator = $this->Validator->make($input, $this->createRules(), $this->messages);
if ($validator->passes()) {
$user = $this->DvsUser;
$user->activated = array_get($input, 'activated', false);
$user->name = array_get($input, 'name', null);
$user->email = array_get($input, 'email');
$user->username = array_get($input, 'username', null);
$user->password = $this->Hash->make(array_get($input, 'password'));
$user->save();
$user->groups()->sync([array_get($input, 'group_id', [])]);
return $user;
}
$this->errors = $validator->errors()->all();
$this->message = "There were validation errors.";
return false;
}