From d4465e2a558319247e450ad92374cbf6287c82d5 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Fri, 28 Feb 2020 16:36:33 +0400 Subject: [PATCH 1/5] PHRAS-2956 #comment fix account-developpers-application #time 3h --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 4a9f380dbe..c58c7b5470 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "normalize-css": "^2.1.0", "npm": "^6.0.0", "npm-modernizr": "^2.8.3", - "phraseanet-production-client": "0.34.141-d", + "phraseanet-production-client": "0.34.43-d", "requirejs": "^2.3.5", "tinymce": "^4.0.28", "underscore": "^1.8.3", diff --git a/yarn.lock b/yarn.lock index bc67e69c04..a2a89846c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7565,10 +7565,10 @@ phantomjs-prebuilt@^2.1.3: request-progress "^2.0.1" which "^1.2.10" -phraseanet-common@^0.4.5-d: - version "0.4.5-d" - resolved "https://registry.yarnpkg.com/phraseanet-common/-/phraseanet-common-0.4.5-d.tgz#193da1ab062f98e99729b7f98a7bbe32c495c7f3" - integrity sha512-7mmPDg0pFnFYyY1eazmUcDa18SGXp90zEBYTNzVan6goPPBjUmA0YwzBiuvDnxlcwMX8x0kDIrOouOBfWG5E1w== +phraseanet-common@^0.4.1: + version "0.4.2" + resolved "https://registry.yarnpkg.com/phraseanet-common/-/phraseanet-common-0.4.2.tgz#740de9bf254116adc506c9703015ab1533f89864" + integrity sha512-uyKULVCV9df161A970mWnZtdxAb/ZWCuUdnSTn0T9AGvwsWvKf2p6+pgEVtBQ81LIGn1m5UlhiF7dUlc6nT7iQ== dependencies: es6-promise "^4.1.1" humane-js "^3.2.2" @@ -7577,10 +7577,10 @@ phraseanet-common@^0.4.5-d: js-cookie "^2.1.0" pym.js "^1.3.1" -phraseanet-production-client@0.34.141-d: - version "0.34.141-d" - resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.141-d.tgz#25a137975af873c17837eaa0180ffe500c936f7f" - integrity sha512-cYRaVtJPh5poYqOruoBwapM7HMp5Bv9NvW9HkEqPYr5p2nfZMzgEjjpyOQHnNkaEI+6w2kDk8KGNYd37HnOTmw== +phraseanet-production-client@0.34.43-d: + version "0.34.43-d" + resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.43-d.tgz#c806ca770e4bef03f5240e50bb54e300d09980bd" + integrity sha512-prvOyamKoRbxB7K0gkOjFtnMOrMLd93bKLQrW6ToTCR3JNnTVGDcRaX+CQoA55YJXZqbwcIj4HtoTtj/HCduJg== dependencies: "@mapbox/mapbox-gl-language" "^0.9.2" "@turf/turf" "^5.1.6" @@ -7611,7 +7611,7 @@ phraseanet-production-client@0.34.141-d: mapbox-gl-circle "^1.6.5" mapbox.js "^2.4.0" nouislider "^9.2.0" - phraseanet-common "^0.4.5-d" + phraseanet-common "^0.4.1" pym.js "^1.3.1" rx "^4.1.0" sprintf-js "^1.1.1" From 64d989f0f933458e7be29e860f18a1ebefa789b3 Mon Sep 17 00:00:00 2001 From: aynsix Date: Mon, 2 Mar 2020 11:04:16 +0300 Subject: [PATCH 2/5] remove application list in user list --- .../Phrasea/Command/User/UserListCommand.php | 55 +------------------ 1 file changed, 2 insertions(+), 53 deletions(-) diff --git a/lib/Alchemy/Phrasea/Command/User/UserListCommand.php b/lib/Alchemy/Phrasea/Command/User/UserListCommand.php index bf3f87e478..b88cd4c359 100644 --- a/lib/Alchemy/Phrasea/Command/User/UserListCommand.php +++ b/lib/Alchemy/Phrasea/Command/User/UserListCommand.php @@ -30,8 +30,8 @@ class UserListCommand extends Command { parent::__construct('user:list'); - $this->setDescription('List of all user (experimental)') - ->addOption('user_id', null, InputOption::VALUE_OPTIONAL, ' The id of user export only info this user ') + $this->setDescription('List of all user (experimental)') + ->addOption('user_id', null, InputOption::VALUE_OPTIONAL, 'The id of user export only info this user ') ->addOption('user_email', null, InputOption::VALUE_OPTIONAL, 'The mail of user export only info this user .') ->addOption('database_id', null, InputOption::VALUE_OPTIONAL, 'Id of database.') ->addOption('collection_id', null, InputOption::VALUE_OPTIONAL, 'Id of the collection.') @@ -39,7 +39,6 @@ class UserListCommand extends Command ->addOption('guest', null, InputOption::VALUE_NONE, 'Only guest user') ->addOption('created', null, InputOption::VALUE_OPTIONAL, 'Created at with operator,aaaa-mm-jj hh:mm:ss.') ->addOption('updated', null, InputOption::VALUE_OPTIONAL, 'Update at with operator,aaaa-mm-jj hh:mm:ss.') - ->addOption('application', null, InputOption::VALUE_NONE, 'List application of user work only if --user_id is set') ->addOption('right', null, InputOption::VALUE_NONE, 'Show right information') ->addOption('adress', null, InputOption::VALUE_NONE, 'Show adress information') ->addOption('models', null, InputOption::VALUE_NONE, "Show only defined models, if --user_id is set with --models it's the template owner") @@ -58,7 +57,6 @@ class UserListCommand extends Command $collectionId = $input->getOption('collection_id'); $lockStatus = $input->getOption('mail_lock_status'); $guest = $input->getOption('guest'); - $application = $input->getOption('application'); $withAdress = $input->getOption('adress'); $created = $input->getOption('created'); $updated = $input->getOption('updated'); @@ -77,11 +75,6 @@ class UserListCommand extends Command if($lockStatus && !$models) $query->addSqlFilter('Users.mail_locked = 1'); if($guest && !$models) $query->include_invite(true)->addSqlFilter('Users.guest = 1'); - if ($application and !$userId) { - $output->writeln('You must provide --user_id when using --application option'); - return 0; - } - /** @var UserRepository $userRepository */ $userRepository = $this->container['repo.users']; @@ -94,11 +87,7 @@ class UserListCommand extends Command } $userList = []; - $showApplication = false; foreach ($users as $key => $user) { - if ($userId and $application) { - $showApplication = true; - } $userList[] = $this->listUser($user, $withAdress, $withRight); $userListRaw[] = array_combine($this->headerTable($withAdress, $withRight), $this->listUser($user, $withAdress, $withRight)); @@ -113,15 +102,6 @@ class UserListCommand extends Command ->setRows($userList) ->render($output); ; - - - if ($showApplication) { - $applicationTable = $this->getHelperSet()->get('table'); - $applicationTable->setHeaders(array( - array(new TableCell('Applications', array('colspan' => 5))), - ['name','callback','client_secret','client_id','token'], - ))->setRows($this->getApplicationOfUser($users[0]))->render($output); - } } @@ -215,37 +195,6 @@ class UserListCommand extends Command ]; } - /** - * @param User $user - * @return array - */ - private function getApplicationOfUser(User $user) - { - $apiRepository = $this->container['repo.api-applications']; - $applications = $apiRepository->findByUser($user); - - if (empty($applications)) { - return []; - } - - $accountRepository = $this->container['repo.api-accounts']; - $apiOauthRepository = $this->container['repo.api-oauth-tokens']; - $usersApplication = []; - foreach ($applications as $application) { - $account = $accountRepository->findByUserAndApplication($user, $application); - $token = $account ? $apiOauthRepository->findDeveloperToken($account) : null; - $usersApplication[] = [ - $application->getName(), - $application->getRedirectUri(), - $application->getClientSecret(), - $application->getClientId(), - ($token) ? $token->getOauthToken() : '-' - ]; - } - - return $usersApplication; - } - /** * @param $withAdress * @param $withRight From 495c9ec296ba17c18af7c378d42a098f98232fc4 Mon Sep 17 00:00:00 2001 From: aynsix Date: Tue, 3 Mar 2020 12:23:19 +0300 Subject: [PATCH 3/5] add client_secret on return --- lib/Alchemy/Phrasea/Command/User/UserApplicationsCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/Command/User/UserApplicationsCommand.php b/lib/Alchemy/Phrasea/Command/User/UserApplicationsCommand.php index cbef2cb103..ef79b178b6 100644 --- a/lib/Alchemy/Phrasea/Command/User/UserApplicationsCommand.php +++ b/lib/Alchemy/Phrasea/Command/User/UserApplicationsCommand.php @@ -246,6 +246,7 @@ class UserApplicationsCommand extends Command $account->getUser()->getId(), $application->getName(), $application->getClientId(), + $application->getClientSecret(), $application->getRedirectUri(), ($token) ? $token->getOauthToken() : '-', $application->isPasswordGranted() ? "true": "false" @@ -253,7 +254,7 @@ class UserApplicationsCommand extends Command } $applicationTable = $this->getHelperSet()->get('table'); - $headers = ['app_id', 'user_id', 'name', 'client_id', 'callback_url', 'generated token', 'grant_password status']; + $headers = ['app_id', 'user_id', 'name', 'client_id', 'client_secret', 'callback_url', 'generated token', 'grant_password status']; if ($jsonformat ) { foreach ($applicationList as $appList) { @@ -312,7 +313,7 @@ class UserApplicationsCommand extends Command $application->isPasswordGranted() ? "true": "false" ]; - $headers = ['client secret', 'client ID', 'Authorize endpoint url', 'Access endpoint', 'generated token', 'grant_password status']; + $headers = ['client_secret', 'client_id', 'Authorize endpoint url', 'Access endpoint', 'generated token', 'grant_password status']; if ($jsonformat ) { $createdAppInfo = array_combine($headers, $applicationCreated); echo json_encode($createdAppInfo); From fd5685f775f5a9682e00d8f7c9377e25f60271fd Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 3 Mar 2020 17:35:11 +0400 Subject: [PATCH 4/5] PHRAS-2956 --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index c58c7b5470..c3b9449fd7 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "normalize-css": "^2.1.0", "npm": "^6.0.0", "npm-modernizr": "^2.8.3", - "phraseanet-production-client": "0.34.43-d", + "phraseanet-production-client": "0.34.145-d", "requirejs": "^2.3.5", "tinymce": "^4.0.28", "underscore": "^1.8.3", diff --git a/yarn.lock b/yarn.lock index a2a89846c2..d955dfe461 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7565,10 +7565,10 @@ phantomjs-prebuilt@^2.1.3: request-progress "^2.0.1" which "^1.2.10" -phraseanet-common@^0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/phraseanet-common/-/phraseanet-common-0.4.2.tgz#740de9bf254116adc506c9703015ab1533f89864" - integrity sha512-uyKULVCV9df161A970mWnZtdxAb/ZWCuUdnSTn0T9AGvwsWvKf2p6+pgEVtBQ81LIGn1m5UlhiF7dUlc6nT7iQ== +phraseanet-common@^0.4.5-d: + version "0.4.5-d" + resolved "https://registry.yarnpkg.com/phraseanet-common/-/phraseanet-common-0.4.5-d.tgz#193da1ab062f98e99729b7f98a7bbe32c495c7f3" + integrity sha512-7mmPDg0pFnFYyY1eazmUcDa18SGXp90zEBYTNzVan6goPPBjUmA0YwzBiuvDnxlcwMX8x0kDIrOouOBfWG5E1w== dependencies: es6-promise "^4.1.1" humane-js "^3.2.2" @@ -7577,10 +7577,10 @@ phraseanet-common@^0.4.1: js-cookie "^2.1.0" pym.js "^1.3.1" -phraseanet-production-client@0.34.43-d: - version "0.34.43-d" - resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.43-d.tgz#c806ca770e4bef03f5240e50bb54e300d09980bd" - integrity sha512-prvOyamKoRbxB7K0gkOjFtnMOrMLd93bKLQrW6ToTCR3JNnTVGDcRaX+CQoA55YJXZqbwcIj4HtoTtj/HCduJg== +phraseanet-production-client@0.34.145-d: + version "0.34.145-d" + resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.145-d.tgz#c820b8d90c0798660430ee87423ef9a757256788" + integrity sha512-QgkQVSg/QzKWiATjlwwNO4k5nU2EU541CSqYgxoXyveeF9ucqPf4K+hYVFqs3ozLsRfnLvcsEA2+PKBxUAoJ9g== dependencies: "@mapbox/mapbox-gl-language" "^0.9.2" "@turf/turf" "^5.1.6" @@ -7611,7 +7611,7 @@ phraseanet-production-client@0.34.43-d: mapbox-gl-circle "^1.6.5" mapbox.js "^2.4.0" nouislider "^9.2.0" - phraseanet-common "^0.4.1" + phraseanet-common "^0.4.5-d" pym.js "^1.3.1" rx "^4.1.0" sprintf-js "^1.1.1" From baed57ba218b1811de9c1c9f83b3fdec6d14d1a6 Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 3 Mar 2020 18:04:25 +0400 Subject: [PATCH 5/5] upgrade phraseanet-production-client --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c3b9449fd7..2d92d90040 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "normalize-css": "^2.1.0", "npm": "^6.0.0", "npm-modernizr": "^2.8.3", - "phraseanet-production-client": "0.34.145-d", + "phraseanet-production-client": "0.34.146-d", "requirejs": "^2.3.5", "tinymce": "^4.0.28", "underscore": "^1.8.3", diff --git a/yarn.lock b/yarn.lock index d955dfe461..06c87497e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7577,10 +7577,10 @@ phraseanet-common@^0.4.5-d: js-cookie "^2.1.0" pym.js "^1.3.1" -phraseanet-production-client@0.34.145-d: - version "0.34.145-d" - resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.145-d.tgz#c820b8d90c0798660430ee87423ef9a757256788" - integrity sha512-QgkQVSg/QzKWiATjlwwNO4k5nU2EU541CSqYgxoXyveeF9ucqPf4K+hYVFqs3ozLsRfnLvcsEA2+PKBxUAoJ9g== +phraseanet-production-client@0.34.146-d: + version "0.34.146-d" + resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.146-d.tgz#39e5e61c38a0719d46a3805d8fe3d7a64b0d7c38" + integrity sha512-0Flp6UuNiSPTo1rF80NyHjjB7sgP0c13gwtfR8Mzx0Rp7s2NFzgJnh4LXwdhWy+/WCQYnXWuH4XTJuRjmT27RA== dependencies: "@mapbox/mapbox-gl-language" "^0.9.2" "@turf/turf" "^5.1.6"