Skip to content

Commit

Permalink
Initial widget skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
axel committed Sep 22, 2020
1 parent 10f4afc commit e49c278
Show file tree
Hide file tree
Showing 25 changed files with 105 additions and 0 deletions.
Empty file.
Empty file.
Empty file.
71 changes: 71 additions & 0 deletions GrouperWidget/Controller/CoGrouperWidgetController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

App::uses("SDWController", "Controller");

class CoGrouperWidgetController extends SDWController {
// Class name, used by Cake
public $name = "CoGrouperWidget";

public $uses = array("GrouperWidget.CoGrouperWidget", "CoGrouper");

/**
* Render the widget according to the requested user and current configuration.
*
* @since COmanage Registry v3.2.0
* @param Integer $id CO Services Widget ID
*/

public function display($id) {
//TODO - need to work on this
$cfg = $this->CoServicesWidget->getConfig();

// For now simply provide the services portal URL for the current CO. All necessary
// logic is already attended to there. See: Views/CoServices/portal.ctp
$services_url = Router::url([
'plugin' => null,
'controller' => 'co_services',
'action' => 'portal',
'co' => $this->cur_co['Co']['id']
]);
$this->set('vv_services_url', $services_url);

// Pass the config so we know which div to overwrite
$this->set('vv_config', $cfg);

}

/**
* Authorization for this Controller, called by Auth component
* - precondition: Session.Auth holds data used for authz decisions
* - postcondition: $permissions set with calculated permissions
*
* @since COmanage Registry v3.2.0
* @return Array Permissions
*/

function isAuthorized() {
//TODO - Need to work on this

$roles = $this->Role->calculateCMRoles();

// Determine what operations this user can perform

// Construct the permission set for this user, which will also be passed to the view.
// Ask the parent to calculate the display permission, based on the configuration.
// Note that the display permission is set at the Dashboard, not Dashboard Widget level.
$p = $this->calculateParentPermissions($roles);

// Delete an existing CO Services Widget?
$p['delete'] = ($roles['cmadmin'] || $roles['coadmin']);

// Edit an existing CO Services Widget?
$p['edit'] = ($roles['cmadmin'] || $roles['coadmin']);

// View an existing CO Services Widget?
$p['view'] = ($roles['cmadmin'] || $roles['coadmin']);

$this->set('permissions', $p);
return($p[$this->action]);
}

}
Empty file.
7 changes: 7 additions & 0 deletions GrouperWidget/Controller/GrouperWidgetAppController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

App::uses('AppController', 'Controller');

class GrouperWidgetAppController extends AppController {

}
Empty file added GrouperWidget/Lib/empty
Empty file.
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions GrouperWidget/Model/CoGrouperWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

App::uses("CoDashboardWidgetBackend", "Model");

class CoGrouperWidget extends CoDashboardWidgetBackend {
// Define class name for cake
public $name = "CoGrouperWidget";

}
Empty file.
11 changes: 11 additions & 0 deletions GrouperWidget/Model/GrouperWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php


class GrouperWidget extends AppModel
{
//Required Param of COmanage
public $cmPluginType = "dashboardwidget";

public $name = "GrouperWidget";

}
7 changes: 7 additions & 0 deletions GrouperWidget/Model/GrouperWidgetAppModel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

App::uses('AppModel', 'Model');

class GrouperWidgetAppModel extends AppModel {

}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added GrouperWidget/View/Helper/empty
Empty file.
Empty file.
Empty file added GrouperWidget/webroot/css/empty
Empty file.
Empty file added GrouperWidget/webroot/img/empty
Empty file.
Empty file added GrouperWidget/webroot/js/empty
Empty file.

0 comments on commit e49c278

Please sign in to comment.