Skip to content

Commit

Permalink
Coding for adding to Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
axel committed Jan 7, 2021
1 parent 69a4800 commit 665fa11
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Config/Schema/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<field name="co_dashboard_widget_id" type="I">
<constraint>REFERENCES cm_co_dashboard_widgets(id)</constraint>
</field>
<field name="connUrl" type="C" size="256" />
<field name="connVer" type="C" size="256" />
<field name="connUser" type="C" size="64" />
<field name="connPass" type="C" size="64" />
<field name="created" type="T" />
<field name="modified" type="T" />

Expand Down
37 changes: 36 additions & 1 deletion Controller/CoGrouperLitesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@

class CoGrouperLitesController extends SDWController {

public $helpers = array('Html', 'Form', 'Flash');
public $components = array('Flash');

// Class name, used by Cake
public $name = "CoGrouperLites";

public $uses = array(
"GrouperLite.CoGrouperLite"
);

public function display($id)
{
echo 'hi there';
//$cfg = $this->CoGrouperLite->getConfig();

$this->set('title', "Grouper Configuration Settings");
// 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
Expand All @@ -20,6 +32,29 @@ public function display($id)
* @since COmanage Registry v3.2.0
* @return Array Permissions
*/
/*
function isAuthorized() {
$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]);
}*/

function isAuthorized()
{
Expand Down
42 changes: 42 additions & 0 deletions Model/CoGrouperLite.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,46 @@ class CoGrouperLite extends CoDashboardWidgetBackend {
"CoDashboardWidget"
);

// Add behaviors
public $actsAs = array('Containable');

public $hasMany = array(
);

public $duplicatableModels = array(
"CoGrouperLite" => array(
"parent" => "CoDashboardWidget",
"fk" => "co_dashboard_widget_id"
)
);

// Validation rules for table elements
public $validate = array(
'co_dashboard_widget_id' => array(
'rule' => 'numeric',
'required' => true,
'allowEmpty' => false
),
'connUrl' => array(
'rule' => 'alphaNumeric',
'required' => true,
'allowEmpty' => false
),
'connVer' => array(
'rule' => 'alphaNumeric',
'required' => true,
'allowEmpty' => false
),
'connUser' => array(
'rule' => 'alphaNumeric',
'required' => true,
'allowEmpty' => false
),
'connPass' => array(
'rule' => 'alphaNumeric',
'required' => true,
'allowEmpty' => false
),
);

}
11 changes: 11 additions & 0 deletions Model/GrouperLite.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ class GrouperLite extends AppModel {
// Required by COmanage Plugins
public $cmPluginType = "dashboardwidget";

// Association rules from this model to other models
public $belongsTo = array(
);

public $hasMany = array(
);

// Validation rules for table elements
public $validate = array(
);

public function cmPluginMenus() {
return array(
"cogroups" => array(
Expand Down
1 change: 0 additions & 1 deletion View/CoGrouperLite/display.ctp

This file was deleted.

1 change: 1 addition & 0 deletions View/CoGrouperLites/display.ctp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yoy are home
14 changes: 14 additions & 0 deletions View/CoGrouperLites/edit.ctp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div id="grouper-plugin" class="pt-2">
<div class="d-flex align-items-center">
<h2><?php echo $title; ?></h2>
</div>
</div>
<?php
echo $this->Form->create('CoGrouperLites');
echo $this->Form->input('connUrl');
echo $this->Form->input('connVer');
echo $this->Form->input('connUser');
echo $this->Form->input('connPass');
echo $this->Form->input('id', array('type' => 'hidden'));
echo $this->Form->end('Save Post');
?>

0 comments on commit 665fa11

Please sign in to comment.