diff --git a/lang/en.json b/lang/en.json index 2d131d5ad5c050a6845823a34ceea056fbfc6fa3..3fe2bf2bca545789cc8c07f5b6510ea4a88138ed 100755 --- a/lang/en.json +++ b/lang/en.json @@ -16,7 +16,9 @@ "blue" : "Blue", "cancel" : "Cancel", "cancelPreviousNote" : "Cancel the previous note", - "configurationUpdated" : "Configuration modifié", + "configurationAdded" : "Configuration added", + "configurationUpdated" : "Configuration updated", + "configurationDeleted" : "Configuration deleted", "connect" : "Log in", "connectionServerFailed" : "The connection to the server failed. Please try again later.", "connexion" : "Connection...", diff --git a/lang/fr.json b/lang/fr.json index 7cfdd517e691735c7f4f2192cd4666600b101c62..563c40ccaaaf02ae87e7b058c9322a4cbe0b6e0a 100755 --- a/lang/fr.json +++ b/lang/fr.json @@ -16,7 +16,9 @@ "blue" : "Bleu", "cancel" : "Annuler", "cancelPreviousNote" : "Annuler la précédente note", - "configurationUpdated" : "Configuration modifié", + "configurationAdded" : "Configuration ajoutée", + "configurationUpdated" : "Configuration modifiée", + "configurationDeleted" : "Configuration supprimée", "connect" : "Se connecter", "connectionServerFailed" : "La connexion au serveur a échoué. Veuillez réessayer ultérieurement.", "connexion" : "Connexion...", diff --git a/rest/index.php b/rest/index.php index 5206ed5942d197ec0577c0ab5c58931c856cbd59..689d902b8831c2f718fc3b0e2457d36b261b8ed4 100755 --- a/rest/index.php +++ b/rest/index.php @@ -59,7 +59,11 @@ $app->get('/attachments/{id}/thumbnails/{page}', \Attachment\controllers\Attachm $app->get('/autocomplete/users', \SrcCore\controllers\AutoCompleteController::class . ':getUsers'); //Configurations -$app->put('/configurations/{identifier}', \Configuration\controllers\ConfigurationController::class . ':update'); +$app->get('/configurations', \Configuration\controllers\ConfigurationController::class . ':get'); +$app->post('/configurations', \Configuration\controllers\ConfigurationController::class . ':create'); +$app->get('/configurations/{id}', \Configuration\controllers\ConfigurationController::class . ':getById'); +$app->patch('/configurations/{id}', \Configuration\controllers\ConfigurationController::class . ':update'); +$app->delete('/configurations/{id}', \Configuration\controllers\ConfigurationController::class . ':delete'); //Documents $app->post('/documents', \Document\controllers\DocumentController::class . ':create'); diff --git a/sql/data_fr.sql b/sql/data_fr.sql index ba195484266cf6587b074f8d8dd2b609e53c26ce..363e54b5f27fd4244592b7c38480c040437c90ba 100755 --- a/sql/data_fr.sql +++ b/sql/data_fr.sql @@ -25,10 +25,10 @@ ALTER SEQUENCE groups_privileges_id_seq RESTART WITH 1; INSERT INTO groups_privileges (group_id, privilege) VALUES (1, 'manage_users'); INSERT INTO groups_privileges (group_id, privilege) VALUES (1, 'manage_documents'); INSERT INTO groups_privileges (group_id, privilege) VALUES (1, 'manage_email_configuration'); +INSERT INTO groups_privileges (group_id, privilege) VALUES (1, 'manage_connections'); INSERT INTO groups_privileges (group_id, privilege) VALUES (1, 'manage_groups'); INSERT INTO groups_privileges (group_id, privilege) VALUES (2, 'manage_users'); INSERT INTO groups_privileges (group_id, privilege) VALUES (2, 'manage_documents'); -INSERT INTO groups_privileges (group_id, privilege) VALUES (2, 'manage_email_configuration'); INSERT INTO groups_privileges (group_id, privilege) VALUES (2, 'manage_groups'); TRUNCATE TABLE users_groups; @@ -67,5 +67,5 @@ INSERT INTO password_rules (label, "value") VALUES ('renewal', 90); ----- TRUNCATE TABLE configurations; INSERT INTO configurations (identifier, value) VALUES ('emailServer', '{"type" : "smtp", "host" : "smtp.gmail.com", "port" : 465, "user" : "", "password" : "", "auth" : true, "secure" : "ssl", "from" : "notifications@maarch.org", "charset" : "utf-8"}'); -INSERT INTO configurations (identifier, value) VALUES ('ldapServer', '[{"uri" : "10.2.95.60", "prefix" : "MAARCH", "suffix" : "", "ssl" : false, "baseDN" : ""}]'); +INSERT INTO configurations (identifier, value) VALUES ('ldapServer', '{"uri" : "10.2.95.60", "prefix" : "MAARCH", "suffix" : "", "ssl" : false, "baseDN" : ""}'); INSERT INTO configurations (identifier, value) VALUES ('connection', '"default"'); diff --git a/sql/structure.sql b/sql/structure.sql index 3a6f64fd61f4f1e32bb71f3f1dd7e9c249257e35..6e0f0f0cfc6405e3e65c67f11e3568d5de17ab42 100755 --- a/sql/structure.sql +++ b/sql/structure.sql @@ -57,8 +57,7 @@ CREATE TABLE configurations id serial NOT NULL, identifier CHARACTER VARYING (64) NOT NULL, value jsonb DEFAULT '{}' NOT NULL, -CONSTRAINT configuration_pkey PRIMARY KEY (id), -CONSTRAINT configuration_unique_key UNIQUE (identifier) +CONSTRAINT configuration_pkey PRIMARY KEY (id) ) WITH (OIDS=FALSE); diff --git a/src/app/configuration/controllers/ConfigurationController.php b/src/app/configuration/controllers/ConfigurationController.php index 096ac8193cfe58ffa7b81b534cb495e3f6724c7a..bf2cefceb7b7b963aee2a5707cda48c91d9546fa 100755 --- a/src/app/configuration/controllers/ConfigurationController.php +++ b/src/app/configuration/controllers/ConfigurationController.php @@ -24,39 +24,138 @@ use SrcCore\models\AuthenticationModel; class ConfigurationController { - public function getByIdentifier(Request $request, Response $response, array $args) + const CONNECTION_MODES = ['default', 'ldap']; + + public function get(Request $request, Response $response) + { + $queryParams = $request->getQueryParams(); + + if (!Validator::stringType()->notEmpty()->validate($queryParams['identifier'])) { + return $response->withStatus(400)->withJson(['errors' => 'QueryParams identifier is empty or not a string']); + } + + if ($queryParams['identifier'] == 'emailServer' && !PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_email_configuration'])) { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); + } elseif ($queryParams['identifier'] == 'ldapServer' && !PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_connections'])) { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); + } + + $configurations = ConfigurationModel::getByIdentifier(['identifier' => $queryParams['identifier']]); + + return $response->withJson(['configurations' => $configurations]); + } + + public function getById(Request $request, Response $response, array $args) { - $configuration = ConfigurationModel::getByIdentifier(['identifier' => $args['identifier']]); + $configuration = ConfigurationModel::getById(['id' => $args['id']]); + + if (empty($configuration)) { + return $response->withStatus(400)->withJson(['errors' => 'Configuration does not exist']); + } + + if ($configuration['identifier'] == 'emailServer' && !PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_email_configuration'])) { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); + } elseif ($configuration['identifier'] == 'ldapServer' && !PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_connections'])) { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); + } + + return $response->withJson(['configuration' => $configuration]); + } + + public function create(Request $request, Response $response) + { + $body = $request->getParsedBody(); + + if (empty($body)) { + return $response->withStatus(400)->withJson(['errors' => 'Body is not set or empty']); + } elseif (!Validator::stringType()->notEmpty()->length(1, 64)->validate($body['identifier'])) { + return $response->withStatus(400)->withJson(['errors' => 'Body identifier is empty, not a string or longer than 64']); + } elseif (!Validator::arrayType()->notEmpty()->validate($body['value'])) { + return $response->withStatus(400)->withJson(['errors' => 'Body value is empty or not an array']); + } - if ($args['identifier'] == 'emailServer') { + if ($body['identifier'] == 'emailServer') { if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_email_configuration'])) { return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); } - } elseif ($args['identifier'] == 'ldapServer') { - if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_ldap_configurations'])) { + $check = ConfigurationController::checkMailer($body['value']); + if (!empty($check['errors'])) { + return $response->withStatus(400)->withJson(['errors' => $check['errors']]); + } + + if ($body['value']['auth'] && !empty($body['value']['password'])) { + $body['value']['password'] = AuthenticationModel::encrypt(['password' => $body['value']['password']]); + } elseif (!$body['value']['auth']) { + $body['value']['user'] = null; + $body['value']['password'] = null; + } + $data = json_encode([ + 'type' => $body['value']['type'], + 'host' => $body['value']['host'], + 'port' => $body['value']['port'], + 'user' => empty($body['value']['user']) ? null : $body['value']['user'], + 'password' => empty($body['value']['password']) ? null : $body['value']['password'], + 'auth' => $body['value']['auth'], + 'secure' => $body['value']['secure'], + 'from' => $body['value']['from'], + 'charset' => empty($body['value']['charset']) ? 'utf-8' : $body['value']['charset'] + ]); + } elseif ($body['identifier'] == 'ldapServer') { + if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_connections'])) { return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); } - } - if (!empty($data)) { - if (empty($configuration)) { - ConfigurationModel::create(['identifier' => $args['identifier'], 'value' => $data]); - } else { - ConfigurationModel::update(['set' => ['value' => $data], 'where' => ['identifier = ?'], 'data' => [$args['identifier']]]); + $check = ConfigurationController::checkLdapConfiguration($body['value']); + if (!empty($check['errors'])) { + return $response->withStatus(400)->withJson(['errors' => $check['errors']]); } + + $data = json_encode([ + 'uri' => $body['value']['uri'], + 'ssl' => $body['value']['ssl'], + 'prefix' => empty($body['value']['prefix']) ? null : $body['value']['prefix'], + 'suffix' => empty($body['value']['suffix']) ? null : $body['value']['suffix'], + 'baseDN' => empty($body['value']['baseDN']) ? null : $body['value']['baseDN'] + ]); + } + + if (empty($data)) { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); } - return $response->withJson(['errors' => 'Privilege forbidden']); + $id = ConfigurationModel::create(['identifier' => $body['identifier'], 'value' => $data]); + + HistoryController::add([ + 'code' => 'OK', + 'objectType' => 'configurations', + 'objectId' => $id, + 'type' => 'CREATION', + 'message' => '{configurationAdded}', + 'data' => ['identifier' => $body['identifier']] + ]); + + return $response->withStatus(204); } public function update(Request $request, Response $response, array $args) { $body = $request->getParsedBody(); - $configuration = ConfigurationModel::getByIdentifier(['identifier' => $args['identifier']]); + if (!Validator::intVal()->notEmpty()->validate($args['id'])) { + return $response->withStatus(400)->withJson(['errors' => 'Route id is not an integer']); + } elseif (empty($body)) { + return $response->withStatus(400)->withJson(['errors' => 'Body is not set or empty']); + } elseif (!Validator::arrayType()->notEmpty()->validate($body['value'])) { + return $response->withStatus(400)->withJson(['errors' => 'Body value is empty or not an array']); + } + + $configuration = ConfigurationModel::getById(['id' => $args['id']]); + if (empty($configuration)) { + return $response->withStatus(400)->withJson(['errors' => 'Configuration does not exist']); + } - if ($args['identifier'] == 'emailServer') { + if ($configuration['identifier'] == 'emailServer') { if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_email_configuration'])) { return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); } @@ -77,44 +176,103 @@ class ConfigurationController $body['user'] = null; $body['password'] = null; } + + if ($body['auth'] && empty($body['value']['password'])) { + $configuration['value'] = json_decode($configuration['value'], true); + if (!empty($configuration['value']['password'])) { + $body['value']['password'] = $configuration['value']['password']; + } + } elseif ($body['value']['auth'] && !empty($body['value']['password'])) { + $body['value']['password'] = AuthenticationModel::encrypt(['password' => $body['value']['password']]); + } elseif (!$body['value']['auth']) { + $body['value']['user'] = null; + $body['value']['password'] = null; + } $data = json_encode([ - 'type' => $body['type'], - 'host' => $body['host'], - 'port' => $body['port'], - 'user' => empty($body['user']) ? null : $body['user'], - 'password' => empty($body['password']) ? null : $body['password'], - 'auth' => $body['auth'], - 'secure' => $body['secure'], - 'from' => $body['from'], - 'charset' => empty($body['charset']) ? 'utf-8' : $body['charset'] + 'type' => $body['value']['type'], + 'host' => $body['value']['host'], + 'port' => $body['value']['port'], + 'user' => empty($body['value']['user']) ? null : $body['value']['user'], + 'password' => empty($body['value']['password']) ? null : $body['value']['password'], + 'auth' => $body['value']['auth'], + 'secure' => $body['value']['secure'], + 'from' => $body['value']['from'], + 'charset' => empty($body['value']['charset']) ? 'utf-8' : $body['value']['charset'] ]); - } elseif ($args['identifier'] == 'ldapServer') { - if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_ldap_configurations'])) { + + } elseif ($configuration['identifier'] == 'ldapServer') { + if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_connections'])) { return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); } - - $check = ConfigurationController::checkLdapConfigurations($body); + $check = ConfigurationController::checkLdapConfiguration($body['value']); if (!empty($check['errors'])) { return $response->withStatus(400)->withJson(['errors' => $check['errors']]); } - $data = json_encode($body); + $data = json_encode([ + 'uri' => $body['value']['uri'], + 'ssl' => $body['value']['ssl'], + 'prefix' => empty($body['value']['prefix']) ? null : $body['value']['prefix'], + 'suffix' => empty($body['value']['suffix']) ? null : $body['value']['suffix'], + 'baseDN' => empty($body['value']['baseDN']) ? null : $body['value']['baseDN'] + ]); + } elseif ($configuration['identifier'] == 'connection') { + if (!PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_connections'])) { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); + } + if (!in_array($body['value'], ConfigurationController::CONNECTION_MODES)) { + return $response->withStatus(400)->withJson(['errors' => 'Connection forbidden']); + } + + $data = $body['value']; } - if (!empty($data)) { - if (empty($configuration)) { - ConfigurationModel::create(['identifier' => $args['identifier'], 'value' => $data]); - } else { - ConfigurationModel::update(['set' => ['value' => $data], 'where' => ['identifier = ?'], 'data' => [$args['identifier']]]); - } + if (empty($data)) { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); } + ConfigurationModel::update(['set' => ['value' => $data], 'where' => ['id = ?'], 'data' => [$args['id']]]); + HistoryController::add([ 'code' => 'OK', 'objectType' => 'configurations', - 'objectId' => $args['identifier'], + 'objectId' => $args['id'], 'type' => 'MODIFICATION', - 'message' => '{configurationUpdated}' + 'message' => '{configurationUpdated}', + 'data' => ['identifier' => $configuration['identifier']] + ]); + + return $response->withStatus(204); + } + + public function delete(Request $request, Response $response, array $args) + { + if (!Validator::intVal()->notEmpty()->validate($args['id'])) { + return $response->withStatus(400)->withJson(['errors' => 'Route id is not an integer']); + } + + $configuration = ConfigurationModel::getById(['id' => $args['id']]); + if (empty($configuration)) { + return $response->withStatus(400)->withJson(['errors' => 'Configuration does not exist']); + } + + if ($configuration['identifier'] == 'emailServer' && !PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_email_configuration'])) { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); + } elseif ($configuration['identifier'] == 'ldapServer' && !PrivilegeController::hasPrivilege(['userId' => $GLOBALS['id'], 'privilege' => 'manage_connections'])) { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); + } elseif ($configuration['identifier'] == 'connection') { + return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); + } + + ConfigurationModel::delete(['id' => $args['id']]); + + HistoryController::add([ + 'code' => 'OK', + 'objectType' => 'configurations', + 'objectId' => $args['id'], + 'type' => 'SUPPRESSION', + 'message' => '{configurationDeleted}', + 'data' => ['identifier' => $configuration['identifier']] ]); return $response->withStatus(204); @@ -128,19 +286,19 @@ class ConfigurationController if ($args['type'] == 'smtp') { if (!Validator::stringType()->notEmpty()->validate($args['host'])) { - return ['errors' => 'Body host is empty or not a string']; + return ['errors' => 'Body[\'value\'] host is empty or not a string']; } elseif (!Validator::intVal()->notEmpty()->validate($args['port'])) { - return ['errors' => 'Body port is empty or not an integer']; + return ['errors' => 'Body[\'value\'] port is empty or not an integer']; } elseif (!Validator::boolType()->validate($args['auth'])) { - return ['errors' => 'Body auth is empty or not a boolean']; + return ['errors' => 'Body[\'value\'] auth is empty or not a boolean']; } elseif (!Validator::stringType()->notEmpty()->validate($args['secure'])) { - return ['errors' => 'Body secure is empty or not a string']; + return ['errors' => 'Body[\'value\'] secure is empty or not a string']; } elseif (!Validator::stringType()->notEmpty()->validate($args['from'])) { - return ['errors' => 'Body from is empty or not a string']; + return ['errors' => 'Body[\'value\'] from is empty or not a string']; } if ($args['auth']) { if (!Validator::stringType()->notEmpty()->validate($args['user'])) { - return ['errors' => 'Body user is empty or not a string']; + return ['errors' => 'Body[\'value\'] user is empty or not a string']; } } } @@ -148,18 +306,12 @@ class ConfigurationController return ['success' => 'success']; } - private static function checkLdapConfigurations(array $configurations) + private static function checkLdapConfiguration(array $configuration) { - if (!Validator::arrayType()->notEmpty()->validate($configurations)) { - return ['errors' => 'Body is empty or not an array']; - } - - foreach ($configurations as $key => $configuration) { - if (!Validator::stringType()->notEmpty()->validate($configuration['uri'])) { - return ['errors' => "Body[{$key}] uri is empty or not a string"]; - } elseif (!Validator::boolType()->validate($configuration['ssl'])) { - return ['errors' => "Body[{$key}] ssl is empty or not a boolean"]; - } + if (!Validator::stringType()->notEmpty()->validate($configuration['uri'])) { + return ['errors' => "Body['value'] uri is empty or not a string"]; + } elseif (!Validator::boolType()->validate($configuration['ssl'])) { + return ['errors' => "Body['value'] ssl is empty or not a boolean"]; } return ['success' => 'success']; diff --git a/src/app/configuration/models/ConfigurationModel.php b/src/app/configuration/models/ConfigurationModel.php index 714e29a560648d9653b2a2a2648b4f80d3784081..95926d59cccd493ffdc5eb68c4a49b86dc5cc4e4 100755 --- a/src/app/configuration/models/ConfigurationModel.php +++ b/src/app/configuration/models/ConfigurationModel.php @@ -19,17 +19,17 @@ use SrcCore\models\ValidatorModel; class ConfigurationModel { - public static function getByIdentifier(array $aArgs) + public static function getById(array $args) { - ValidatorModel::notEmpty($aArgs, ['identifier']); - ValidatorModel::stringType($aArgs, ['identifier']); - ValidatorModel::arrayType($aArgs, ['select']); + ValidatorModel::notEmpty($args, ['id']); + ValidatorModel::intVal($args, ['id']); + ValidatorModel::arrayType($args, ['select']); $configuration = DatabaseModel::select([ - 'select' => empty($aArgs['select']) ? ['*'] : $aArgs['select'], + 'select' => empty($args['select']) ? ['*'] : $args['select'], 'table' => ['configurations'], - 'where' => ['identifier = ?'], - 'data' => [$aArgs['identifier']], + 'where' => ['id = ?'], + 'data' => [$args['id']], ]); if (empty($configuration[0])) { @@ -39,32 +39,65 @@ class ConfigurationModel return $configuration[0]; } + public static function getByIdentifier(array $args) + { + ValidatorModel::notEmpty($args, ['identifier']); + ValidatorModel::stringType($args, ['identifier']); + ValidatorModel::arrayType($args, ['select']); + + $configurations = DatabaseModel::select([ + 'select' => empty($args['select']) ? ['*'] : $args['select'], + 'table' => ['configurations'], + 'where' => ['identifier = ?'], + 'data' => [$args['identifier']], + ]); + + return $configurations; + } + public static function create(array $args) { ValidatorModel::notEmpty($args, ['identifier', 'value']); ValidatorModel::stringType($args, ['identifier', 'value']); + $nextSequenceId = DatabaseModel::getNextSequenceValue(['sequenceId' => 'users_id_seq']); + DatabaseModel::insert([ 'table' => 'configurations', 'columnsValues' => [ + 'id' => $nextSequenceId, 'identifier' => $args['identifier'], 'value' => $args['value'] ] ]); - return true; + return $nextSequenceId; } - public static function update(array $aArgs) + public static function update(array $args) { - ValidatorModel::notEmpty($aArgs, ['set', 'where', 'data']); - ValidatorModel::arrayType($aArgs, ['set', 'where', 'data']); + ValidatorModel::notEmpty($args, ['set', 'where', 'data']); + ValidatorModel::arrayType($args, ['set', 'where', 'data']); DatabaseModel::update([ 'table' => 'configurations', - 'set' => $aArgs['set'], - 'where' => $aArgs['where'], - 'data' => $aArgs['data'] + 'set' => $args['set'], + 'where' => $args['where'], + 'data' => $args['data'] + ]); + + return true; + } + + public static function delete(array $args) + { + ValidatorModel::notEmpty($args, ['id']); + ValidatorModel::intVal($args, ['id']); + + DatabaseModel::delete([ + 'table' => 'configurations', + 'where' => ['id = ?'], + 'data' => [$args['id']] ]); return true; diff --git a/src/app/group/controllers/GroupController.php b/src/app/group/controllers/GroupController.php index e766a5978e709b881f1e94b1516f0eb3b2d9bb71..51f8948fa7bbcd481ab04968fa74e8efa7f9ff8d 100755 --- a/src/app/group/controllers/GroupController.php +++ b/src/app/group/controllers/GroupController.php @@ -32,7 +32,7 @@ class GroupController return $response->withStatus(403)->withJson(['errors' => 'Privilege forbidden']); } - $groups = GroupModel::get([]); + $groups = GroupModel::get(); return $response->withJson(['groups' => $groups]); } diff --git a/src/app/group/controllers/PrivilegeController.php b/src/app/group/controllers/PrivilegeController.php index 696aa968899d0b45da70a74b27cb8b50e7a3b8e5..fce4263803fda861ca9f8568f8e0197fff5d5ff3 100755 --- a/src/app/group/controllers/PrivilegeController.php +++ b/src/app/group/controllers/PrivilegeController.php @@ -25,7 +25,7 @@ class PrivilegeController const PRIVILEGES = [ ['id' => 'manage_users', 'type' => 'admin', 'icon' => 'fa fa-user', 'route' => '/administration/users'], ['id' => 'manage_groups', 'type' => 'admin', 'icon' => 'fa fa-users', 'route' => '/administration/groups'], - ['id' => 'manage_ldap_configurations', 'type' => 'admin', 'icon' => 'fas fa-database', 'route' => '/administration/ldaps'], + ['id' => 'manage_connections', 'type' => 'admin', 'icon' => 'fas fa-database', 'route' => '/administration/ldaps'], ['id' => 'manage_email_configuration', 'type' => 'admin', 'icon' => 'fa fa-paper-plane', 'route' => '/administration/configuration'], ['id' => 'manage_documents', 'type' => 'simple'] ]; diff --git a/src/app/group/models/GroupModel.php b/src/app/group/models/GroupModel.php index 094c300a1de0a401010c119150cf4912adca95c5..5cb31487cbe0af184b02e9617dd528952d5dd7fe 100755 --- a/src/app/group/models/GroupModel.php +++ b/src/app/group/models/GroupModel.php @@ -19,7 +19,7 @@ use SrcCore\models\ValidatorModel; class GroupModel { - public static function get(array $aArgs) + public static function get(array $aArgs = []) { ValidatorModel::arrayType($aArgs, ['select', 'where', 'data', 'orderBy']); ValidatorModel::intType($aArgs, ['limit']); diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php index da1c8962348e78e3aeb65495ae7241d48fa7e07a..4f9a1f2f62bdce2fa689527775b7e4cffbf16dc7 100755 --- a/src/core/controllers/AuthenticationController.php +++ b/src/core/controllers/AuthenticationController.php @@ -143,6 +143,7 @@ class AuthenticationController unset($user['refresh_token'][$key]); } } + $user['refresh_token'] = array_values($user['refresh_token']); if (count($user['refresh_token']) > 10) { array_shift($user['refresh_token']); }