Skip to content

Commit

Permalink
Merge pull request #102 from silinternational/develop
Browse files Browse the repository at this point in the history
Release 4.0.0
  • Loading branch information
briskt authored May 19, 2020
2 parents 289d3b1 + e5c4cb8 commit 76a0e07
Show file tree
Hide file tree
Showing 15 changed files with 241 additions and 336 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [4.0.0] - 2020-05-18
### Removed
- Remove Insite ID Store adapter
### Added
- New config option for converting Workday fields into ID Broker 'groups'

## [3.3.1] - 2020-05-12
### Fixed
- Application logs from console scripts sent to stdout
Expand Down Expand Up @@ -171,7 +177,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
- First release.

[Unreleased]: https://github.com/silinternational/idp-id-sync/compare/3.3.1...develop
[Unreleased]: https://github.com/silinternational/idp-id-sync/compare/4.0.0...develop
[4.0.0]: https://github.com/silinternational/idp-id-sync/compare/3.3.1...4.0.0
[3.3.1]: https://github.com/silinternational/idp-id-sync/compare/3.3.0...3.3.1
[3.3.0]: https://github.com/silinternational/idp-id-sync/compare/3.2.0...3.3.0
[3.2.0]: https://github.com/silinternational/idp-id-sync/compare/3.1.0...3.2.0
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ psr2:

# NOTE: When running tests locally, make sure you don't exclude the integration
# tests (which we do when testing on Codeship).
test: deps app broker
test: deps unittest app broker
sleep 15 && make behat

testci: deps app broker
docker-compose run --rm cli bash -c "./run-tests.sh"

unittest:
docker-compose run --rm cli vendor/bin/phpunit
2 changes: 1 addition & 1 deletion application/check-psr2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Try to install composer dev dependencies
cd /data
composer install --no-interaction --no-scripts
composer install --no-interaction --no-scripts --no-progress

# Check the code against PSR-2.
vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no .
Expand Down
3 changes: 0 additions & 3 deletions application/common/components/IdStoreBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace Sil\Idp\IdSync\common\components;

use Sil\Idp\IdSync\common\components\adapters\GoogleSheetsIdStore;
use Sil\Idp\IdSync\common\components\adapters\InsiteIdStore;
use Sil\Idp\IdSync\common\components\adapters\SagePeopleIdStore;
use Sil\Idp\IdSync\common\components\adapters\WorkdayIdStore;
use Sil\Idp\IdSync\common\components\adapters\fakes\FakeIdStore;
Expand All @@ -14,14 +13,12 @@ abstract class IdStoreBase extends Component implements IdStoreInterface
{
const ADAPTER_FAKE = 'fake';
const ADAPTER_GOOGLE_SHEETS = 'googlesheets';
const ADAPTER_INSITE = 'insite';
const ADAPTER_WORKDAY = 'workday';
const ADAPTER_SAGE_PEOPLE = 'sagepeople';

protected static $adapters = [
self::ADAPTER_FAKE => FakeIdStore::class,
self::ADAPTER_GOOGLE_SHEETS => GoogleSheetsIdStore::class,
self::ADAPTER_INSITE => InsiteIdStore::class,
self::ADAPTER_WORKDAY => WorkdayIdStore::class,
self::ADAPTER_SAGE_PEOPLE => SagePeopleIdStore::class,
];
Expand Down
188 changes: 0 additions & 188 deletions application/common/components/adapters/InsiteIdStore.php

This file was deleted.

35 changes: 25 additions & 10 deletions application/common/components/adapters/WorkdayIdStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class WorkdayIdStore extends IdStoreBase
public $apiUrl = null;
public $username = null;
public $password = null;
public $groupsFields = null;

public $timeout = 45; // Timeout in seconds (per call to ID Store API).

Expand Down Expand Up @@ -122,16 +123,7 @@ public function getAllActiveUsers()
), 1532982679);
}

foreach ($allActiveUsers as $key => $user) {
$companyIDs = str_replace(" ", ",", $user["company_ids"] ?? "");
$ouTree = str_replace(" ", ",", $user["ou_tree"] ?? "");
if (strlen($companyIDs) > 0 && strlen($ouTree) > 0) {
$groups = $companyIDs . "," . $ouTree;
} else {
$groups = $companyIDs . $ouTree;
}
$allActiveUsers[$key]['Groups'] = $groups;
}
$this->generateGroupsLists($allActiveUsers);

return self::getAsUsers($allActiveUsers);
}
Expand All @@ -153,4 +145,27 @@ public function getIdStoreName(): string
{
return 'Workday';
}

public function generateGroupsLists(array &$users)
{
if ($this->groupsFields === null) {
$groupsFields = [
'company_ids',
'ou_tree',
];
} else {
$groupsFields = explode(',', $this->groupsFields);
}

foreach ($users as $key => $user) {
$groups = [];
foreach ($groupsFields as $groupsField) {
if (strlen($user[$groupsField]) > 0) {
$groupsSubList = explode(' ', $user[$groupsField ?? '']);
$groups = array_merge($groups, $groupsSubList);
}
}
$users[$key]['Groups'] = implode(',', $groups);
}
}
}
16 changes: 13 additions & 3 deletions application/common/components/adapters/fakes/FakeIdStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace Sil\Idp\IdSync\common\components\adapters\fakes;

use Sil\Idp\IdSync\common\components\IdStoreBase;
use Sil\Idp\IdSync\common\components\adapters\InsiteIdStore;
use Sil\Idp\IdSync\common\models\User;
use yii\helpers\ArrayHelper;

class FakeIdStore extends IdStoreBase
Expand Down Expand Up @@ -90,8 +90,18 @@ public function getAllActiveUsers()

public static function getIdBrokerFieldNames()
{
// For simplicity's sake, just use the field names from Insite.
return InsiteIdStore::getIdBrokerFieldNames();
return [
'employeenumber' => User::EMPLOYEE_ID,
'firstname' => User::FIRST_NAME,
'lastname' => User::LAST_NAME,
'displayname' => User::DISPLAY_NAME,
'email' => User::EMAIL,
'username' => User::USERNAME,
'locked' => User::LOCKED,
'requires2sv' => User::REQUIRE_MFA,
'supervisoremail' => User::MANAGER_EMAIL,
// No 'active' needed, since all ID Store records returned are active.
];
}

public function getIdStoreName(): string
Expand Down
9 changes: 5 additions & 4 deletions application/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@
"ext-json": "*",
"fillup/fake-bower-assets": "2.0.9",
"forevermatt/calc-api-sig": "^0.1.1",
"roave/security-advisories": "dev-master",
"silinternational/email-service-php-client": "^2.0",
"silinternational/idp-id-broker-php-client": "^3.0.0",
"silinternational/php-array-dot-notation": "0.1.0",
"silinternational/php-env": "^2.1.1",
"silinternational/psr3-adapters": "^1.1",
"silinternational/yii2-json-log-targets": "^1.1",
"silinternational/yii2-json-log-targets": "^2.0",
"yiisoft/yii2": "~2.0.15",
"yiisoft/yii2-gii": "^2.0",
"yiisoft/yii2-swiftmailer": "^2.0",
"guzzlehttp/guzzle": "^6.2",
"google/apiclient": "^2.0"
"google/apiclient": "^2.0",
"codemix/yii2-streamlog": "^1.3"
},
"require-dev": {
"behat/behat": "^3.3",
"phpunit/phpunit": "^6.0",
"friendsofphp/php-cs-fixer": "^2.9"
"friendsofphp/php-cs-fixer": "^2.9",
"roave/security-advisories": "dev-master"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 76a0e07

Please sign in to comment.