Skip to content
Snippets Groups Projects
Verified Commit e324f978 authored by Damien's avatar Damien
Browse files

FEAT #12091 TIME 0:20 Onlyoffice when create user

parent ec35a720
No related branches found
No related tags found
No related merge requests found
......@@ -32,11 +32,14 @@ if (empty($user)) {
if (empty($ozwilloConfig['entityId'])) {
$ozwilloConfig['entityId'] = 'VILLE';
}
$group = \Group\models\GroupModel::getByGroupId(['groupId' => $ozwilloConfig['groupId'], 'select' => ['id']]);
$firstname = empty($profile->given_name) ? 'utilisateur' : $profile->given_name;
$lastname = empty($profile->family_name) ? 'utilisateur' : $profile->family_name;
\User\models\UserModel::create(['user' => ['userId' => $idToken->sub, 'firstname' => $firstname, 'lastname' => $lastname]]);
$preferences = ['documentEdition' => 'java'];
\User\models\UserModel::create(['user' => ['userId' => $idToken->sub, 'firstname' => $firstname, 'lastname' => $lastname, 'preferences' => json_encode($preferences)]]);
$user = \User\models\UserModel::getByLogin(['login' => $idToken->sub]);
\User\models\UserModel::addGroup(['id' => $user['id'], 'groupId' => $ozwilloConfig['groupId']]);
\User\models\UserGroupModel::create(['user_id' => $user['id'], 'group_id' => $group['id']]);
\User\models\UserEntityModel::addUserEntity(['id' => $user['id'], 'entityId' => $ozwilloConfig['entityId'], 'primaryEntity' => 'Y']);
}
......
......@@ -23,6 +23,13 @@ class DocumentEditorController
const DOCUMENT_EDITION_METHODS = ['java', 'onlyoffice'];
public static function get(Request $request, Response $response)
{
$allowedMethods = DocumentEditorController::getAllowedMethods();
return $response->withJson($allowedMethods);
}
public static function getAllowedMethods()
{
$loadedXml = CoreConfigModel::getXmlLoaded(['path' => 'apps/maarch_entreprise/xml/documentEditorsConfig.xml']);
......@@ -33,6 +40,6 @@ class DocumentEditorController
}
}
return $response->withJson($allowedMethods);
return $allowedMethods;
}
}
......@@ -205,6 +205,13 @@ class UserController
$data['loginmode'] = 'standard';
}
$preferences = ['documentEdition' => 'java'];
$allowedMethods = DocumentEditorController::getAllowedMethods();
if (in_array('onlyoffice', $allowedMethods)) {
$preferences = ['documentEdition' => 'onlyoffice'];
}
$data['preferences'] = json_encode($preferences);
$id = UserModel::create(['user' => $data]);
$userQuota = ParameterModel::getById(['id' => 'user_quota', 'select' => ['param_value_int']]);
......
......@@ -84,7 +84,7 @@ abstract class UserModelAbstract
{
ValidatorModel::notEmpty($args, ['user']);
ValidatorModel::notEmpty($args['user'], ['userId', 'firstname', 'lastname']);
ValidatorModel::stringType($args['user'], ['userId', 'firstname', 'lastname', 'mail', 'initials', 'phone', 'loginmode']);
ValidatorModel::stringType($args['user'], ['userId', 'firstname', 'lastname', 'mail', 'initials', 'phone', 'loginmode', 'preferences']);
$password = AuthenticationModel::generatePassword();
$nextSequenceId = DatabaseModel::getNextSequenceValue(['sequenceId' => 'users_id_seq']);
......@@ -100,6 +100,7 @@ abstract class UserModelAbstract
'phone' => $args['user']['phone'],
'initials' => $args['user']['initials'],
'status' => 'OK',
'preferences' => $args['user']['preferences'],
'loginmode' => empty($args['user']['loginmode']) ? 'standard' : $args['user']['loginmode'],
'password' => AuthenticationModel::getPasswordHash($password),
'password_modification_date' => 'CURRENT_TIMESTAMP'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment