Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'develop'
axel committed Mar 25, 2021
2 parents e49c278 + 2654b5c commit 85d10ce
Showing 124 changed files with 99,176 additions and 0 deletions.
Empty file added Config/Schema/empty
Empty file.
48 changes: 48 additions & 0 deletions Config/Schema/schema.xml
@@ -0,0 +1,48 @@
<?xml version="1.0" ?>
<!--
COmanage Registry Notification Widget Plugin Database Schema
Portions licensed to the University Corporation for Advanced Internet
Development, Inc. ("UCAID") under one or more contributor license agreements.
See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
UCAID licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
While this schema mostly works with database prefixes, foreign key constraints
must be specified in raw SQL, which needs the prefixed table name.
-->
<schema version="0.3">
<table name="co_grouper_lites">
<field name="id" type="I">
<key />
<autoincrement />
</field>
<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" />

<index name="co_grouper_lites_i1">
<col>co_dashboard_widget_id</col>
<unique />
</index>
</table>
</schema>
84 changes: 84 additions & 0 deletions Controller/CoGrouperLitesController.php
@@ -0,0 +1,84 @@
<?php

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

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"
);

/**
* Callback after controller methods are invoked but before views are rendered.
*
* @since COmanage Registry v3.2.0
*/

function beforeRender() {
$this->set('title_for_layout', _txt('pl.grouperlite.config.edit.title'));

parent::beforeRender();
}

public function display($id) {
$cfg = $this->CoGrouperLite->getConfig();

$this->set('pl_grouperlite_index_url', Router::url([
'plugin' => "grouper_lite",
'controller' => 'GrouperGroups',
'action' => 'index',
'co' => $this->cur_co['Co']['id'],
'glid' => $id
]));
$this->set('title_for_layout', _txt('pl.grouperlite.config.display.title'));

$this->set('coid', $this->cur_co['Co']['id']);
$this->set('glid', $id);

// 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() {
$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);

$p['add'] = ($roles['cmadmin'] || $roles['coadmin']);

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

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

// View an existing Grouper Widget
//Not sure the difference between view and index, so will open both to comembers.
$p['view'] = ($roles['cmadmin'] || $roles['coadmin'] || $roles['comember']);
$p['index'] = ($roles['cmadmin'] || $roles['coadmin'] || $roles['comember']);

$this->set('permissions', $p);
return ($p[$this->action]);
}
}
Empty file added Controller/Component/empty
Empty file.

0 comments on commit 85d10ce

Please sign in to comment.