Skip to content

Commit

Permalink
fix provisioner function parameter type
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Jan 26, 2024
1 parent f88f44e commit 7d69d36
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
use Cake\Validation\Validator;
use App\Lib\Enum\ProvisioningEligibilityEnum;
use App\Lib\Enum\ProvisioningStatusEnum;
use \FileConnector\Model\Entity\FileProvisioner;

class FileProvisionersTable extends Table {
use \App\Lib\Traits\ChangelogBehaviorTrait;
Expand Down Expand Up @@ -108,17 +109,18 @@ public function buildRules(RulesChecker $rules): RulesChecker {

/**
* Provision object data to the provisioning target.
*
* @since COmanage Registry v5.0.0
* @param SqlProvisioner $provisioningTarget FileProvisioner configuration
* @param string $className Class name of primary object being provisioned
* @param object $data Provisioning data in Entity format (eg: \App\Model\Entity\Person)
* @param ProvisioningEligibilityEnum $eligibility Provisioning Eligibility Enum
*
* @param FileProvisioner $provisioningTarget FileProvisioner configuration
* @param string $entityName
* @param object $data Provisioning data in Entity format (eg: \App\Model\Entity\Person)
* @param string $eligibility Provisioning Eligibility Enum
*
* @return array Array of status, comment, and optional identifier
* @since COmanage Registry v5.0.0
*/

public function provision(
\FileProvisioner\Model\Entity\FileProvisioner $provisioningTarget,
FileProvisioner $provisioningTarget,
string $entityName,
object $data,
string $eligibility
Expand Down
143 changes: 98 additions & 45 deletions app/src/Controller/DashboardsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
namespace App\Controller;

// XXX not doing anything with Log yet
use App\Lib\Util\StringUtilities;
use Cake\Log\Log;
use Cake\ORM\TableRegistry;
use Cake\Utility\Hash;
Expand All @@ -45,37 +46,83 @@ class DashboardsController extends StandardController {

public function initialize(): void {
parent::initialize();

// Configure breadcrumb rendering
$this->Breadcrumb->skipConfig([
'/^\/dashboards\/artifacts/',
'/^\/dashboards\/dashboard/',
'/^\/dashboards\/registries/',
'/^\/dashboards\/search/'
]);
'/^\/dashboards\/artifacts/',
'/^\/dashboards\/dashboard/',
'/^\/dashboards\/registries/',
'/^\/dashboards\/search/'
]);
// There is currently no inventory of dashboards, so we skip parents
// for configuration, dashboard, and registries actions
$this->Breadcrumb->skipParents(['/^\/dashboards/']);
}

/**
* Render the CO Registries Dashboard.
*
* @since COmanage Registry v5.0.0
*/

public function artifacts() {
$cur_co = $this->getCO();

[$title, , ] = StringUtilities::entityAndActionToTitle($cur_co,
'artifacts',
$this->request->getParam('action'),
'menu');
$this->set('vv_title', $title);

// Construct the set of primary registry objects, which
// we want to order by the localized text string.

// We're assuming that the permission for each of these items is the same as for
// registries() itself, ie: CMP or CO Admin. But plausibly some of this stuff
// could be delegated to (eg) a COU Admin at some point...

$artifactMenuItems = [
__d('controller', 'ExtIdentitySourceRecords', [99]) => [
'icon' => 'assignment',
'controller' => 'ext_identity_source_records',
'action' => 'index'
],
__d('controller', 'Jobs', [99]) => [
'icon' => 'assignment',
'controller' => 'jobs',
'action' => 'index'
]
];

ksort($artifactMenuItems);

$this->set('vv_artifacts_menu_items', $artifactMenuItems);
}

/**
* Render the CO Configuration Dashboard.
*
* @since COmanage Registry v5.0.0
*/

public function configuration() {
$cur_co = $this->getCO();

$this->set('vv_title', __d('menu', 'co.features.all'));


[$title, , ] = StringUtilities::entityAndActionToTitle(null,
'co.features',
'all',
'menu');
$this->set('vv_title', $title);

// Construct the set of configuration items. For everything except CO Settings
// we want to order by the localized text string.

// We're assuming that the permission for each of these items is the same as for
// configuration() itself, ie: CMP or CO Admin. But plausibly some of this stuff
// could be delegated to (eg) a COU Admin at some point...

$configMenuItems = [
__d('controller', 'ApiUsers', [99]) => [
'icon' => 'vpn_key',
Expand Down Expand Up @@ -107,7 +154,7 @@ public function configuration() {
'controller' => 'provisioning_targets',
'action' => 'index'
],
// XXX restore when Reports are ready to be exposed.
// XXX restore when Reports are ready to be exposed.
// __d('controller', 'Reports', [99]) => [
// 'icon' => 'summarize',
// 'controller' => 'reports',
Expand All @@ -119,27 +166,27 @@ public function configuration() {
'action' => 'index'
]
];

ksort($configMenuItems);

// Insert CO Settings to the front of the list

$configMenuItems = array_merge([
__d('controller', 'CoSettings', [99]) => [
'icon' => 'settings',
'controller' => 'co_settings',
'action' => 'manage'
]],
$configMenuItems
__d('controller', 'CoSettings', [99]) => [
'icon' => 'settings',
'controller' => 'co_settings',
'action' => 'manage'
]],
$configMenuItems
);

$this->set('vv_configuration_menu_items', $configMenuItems);

$platformMenuItems = [];

if($this->getCOID() == 1) {
// Also pass the platform menu items

$platformMenuItems = [
__d('controller', 'Cos', [99]) => [
'icon' => 'home',
Expand All @@ -153,11 +200,11 @@ public function configuration() {
]
];
}

ksort($platformMenuItems);

$this->set('vv_platform_menu_items', $platformMenuItems);

$registryMenuItems = [
__d('controller', 'Groups', [99]) => [
'icon' => 'people',
Expand All @@ -175,11 +222,11 @@ public function configuration() {
'action' => 'index'
]
];

ksort($registryMenuItems);

$this->set('vv_registries_menu_items', $registryMenuItems);

$artifactMenuItems = [
__d('controller', 'ExtIdentitySourceRecords', [99]) => [
'icon' => 'assignment',
Expand All @@ -192,19 +239,19 @@ public function configuration() {
'action' => 'index'
]
];

ksort($artifactMenuItems);

$this->set('vv_artifacts_menu_items', $artifactMenuItems);
}

/**
* Render a Dashboard.
*
* @since COmanage Registry v5.0.0
* @param int $id Dashboard ID
*/

public function dashboard(?int $id=null) {
// XXX placeholder
}
Expand All @@ -214,15 +261,15 @@ public function dashboard(?int $id=null) {
*
* @since COmanage Registry v5.0.0
*/

public function search() {
/* To add a new backend to search:
* (1) Implement $model->search($id, $q, $limit)
* (2) Add the model to $models here, and define which roles can query it
* (3) Update documentation at https://spaces.at.internet2.edu/pages/viewpage.action?pageId=243078053
*/
$models = [

$models = [
'Addresses' => [
'parent' => ['People' => 'person_id', 'PersonRoles' => 'person_role_id'],
'roles' => ['platformAdmin', 'coAdmin'],
Expand Down Expand Up @@ -293,7 +340,7 @@ public function search() {
// A search was passed in from the form on the Global Search bar.
$q = trim($this->request->getData('q'));
}

// Only process the request if we have a string of non-space characters
if(!empty($q)) {

Expand Down Expand Up @@ -358,7 +405,7 @@ public function search() {
// or if there is a single result overall, redirect to that result.
if((count($results['Cos']) == 0
&& (count($results['People']) + count($results['Groups'])) == 1)
||
||
(count($results['Cos']) == 1
&& (count($results['People']) + count($results['Groups'])) == 0)) {
// Figure out which model matched, as well as the target model to redirect to
Expand All @@ -373,18 +420,18 @@ public function search() {
$matchClass = array_key_first($results[$m][$targetRecordId]);
}
}

$this->Flash->information(__d('result',
'search.exact',
[filter_var($this->request->getData('q'), FILTER_SANITIZE_SPECIAL_CHARS),
__d('controller', $matchClass, [1])]));
__d('controller', $matchClass, [1])]));

// Redirect to the matchClass controller
return $this->redirect([
'controller' => Inflector::dasherize($targetClass),
'action' => 'edit',
$targetRecordId
]);
'controller' => Inflector::dasherize($targetClass),
'action' => 'edit',
$targetRecordId
]);

// XXX handle plugins
} elseif(count($results['Cos'])
Expand All @@ -394,6 +441,12 @@ public function search() {
}

$this->set('vv_results', $results);
$this->set('vv_title', __d('result', 'search.results'));
// XXX The action is search and the result is not a modelPath. In this use the pattern is reversed. We should
// probably reconsider the po naming for the result domain
[$title, , ] = StringUtilities::entityAndActionToTitle(null,
'search',
'results',
'result');
$this->set('vv_title', $title);
}
}

0 comments on commit 7d69d36

Please sign in to comment.