Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ APP_SECRET=5d7a0707cb424e190a468b862a510519
###< symfony/framework-bundle ###

APP_CAMUNDA_PASS_GENERATION_SALT=01b8861defa2d5165195bccdd3a90814b
APP_MATTERMOST_PASS_GENERATION_SALT=01b8861defa2d5165195bccdd3a90814b
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,22 @@ camunda1:
camunda2:
type: 'camunda'
baseUrl: 'http://172.17.0.1:8081/engine-rest/'
```
github:
type: 'github'
token: 'yourSecretToken'
baseUrl: ''
apacheds:
type: 'ldap'
baseUrl: 'ldap://ldap:10389'
bindRdn: 'uid=admin,ou=system'
password: 'secret'
domain:
- 'internal'
- 'com'
mattermost:
type: 'mattermost'
baseUrl: 'http://mattermost-preview:8065'
token: 'mattermostToken'
login: 'admin'
password: 'secret'
```
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "4.3.*",
"symfony/yaml": "4.3.*",
"linkorb/org-sync": "^1.0"
"linkorb/org-sync": "^1.2"
},
"require-dev": {
"phpunit/phpunit": "^8"
},
"repositories": [
{
"type": "vcs",
"url": "git@github.com:amsprost/org-sync.git"
}
],
"config": {
"preferred-install": {
"*": "dist"
Expand Down
156 changes: 132 additions & 24 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,23 @@ services:
arguments:
$map:
LinkORB\OrgSync\DTO\Target\Camunda: '@LinkORB\OrgSync\SynchronizationAdapter\AdapterFactory\CamundaAdapterFactory'
LinkORB\OrgSync\DTO\Target\Github: '@LinkORB\OrgSync\SynchronizationAdapter\AdapterFactory\GithubAdapterFactory'
LinkORB\OrgSync\DTO\Target\Ldap: '@LinkORB\OrgSync\SynchronizationAdapter\AdapterFactory\LdapAdapterFactory'
LinkORB\OrgSync\DTO\Target\Mattermost: '@LinkORB\OrgSync\SynchronizationAdapter\AdapterFactory\MattermostAdapterFactory'

Github\Client:
class: Github\Client
arguments:
$apiVersion: 'v3'

LinkORB\OrgSync\SynchronizationAdapter\AdapterFactory\CamundaAdapterFactory:
arguments:
$defaultPassSalt: '%env(APP_CAMUNDA_PASS_GENERATION_SALT)%'

LinkORB\OrgSync\SynchronizationAdapter\AdapterFactory\MattermostAdapterFactory:
arguments:
$defaultPassSalt: '%env(APP_MATTERMOST_PASS_GENERATION_SALT)%'

LinkORB\OrgSync\Services\Target\TargetPool:
arguments:
$denormalizer: '@linkorb.org_sync.serializer'
Expand Down
34 changes: 23 additions & 11 deletions src/Command/SetUserPasswordCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ public function execute(InputInterface $input, OutputInterface $output)

return 1;
}
$userToSetPassword->setPassword($password);

$this->synchronizationMediator->setPassword($userToSetPassword, $password);
$userToSetPassword->setPreviousPassword(
$this->getPassword($input, $output, 'Previous password (if you have): ', false)
);

$this->synchronizationMediator->setPassword($userToSetPassword);

$output->writeln('Password changed successfully');
}
Expand All @@ -101,22 +106,29 @@ private function findUserToSetPassword(string $usernameToSetPassword, array $use
return null;
}

private function getPassword(InputInterface $input, OutputInterface $output, string $message): string
private function getPassword(
InputInterface $input,
OutputInterface $output,
string $message,
bool $isRequired = true
): ?string
{
$helper = $this->getHelper('question');

$question = new Question($message);
$question->setHidden(true);
$question->setHiddenFallback(false);
$question->setValidator(function ($password) {
if (!is_string($password) || empty($password)) {
throw new RuntimeException(
'Password should be non empty string'
);
}

return $password;
});
if ($isRequired) {
$question->setValidator(function ($password) {
if (!is_string($password) || empty($password)) {
throw new RuntimeException(
'Password should be non empty string'
);
}

return $password;
});
}

return $helper->ask($input, $output, $question);
}
Expand Down
9 changes: 9 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"gnello/php-mattermost-driver": {
"version": "v2.9.0"
},
"linkorb/org-sync": {
"version": "v1.2.0"
},
"pimple/pimple": {
"version": "v3.2.3"
},
"psr/cache": {
"version": "1.0.1"
},
Expand Down