diff --git a/Controller/CoGrouperLitesController.php b/Controller/CoGrouperLitesController.php
index 57b143a..ccbaa42 100644
--- a/Controller/CoGrouperLitesController.php
+++ b/Controller/CoGrouperLitesController.php
@@ -31,7 +31,7 @@ public function display($id) {
$this->set('pl_grouperlite_index_url', Router::url([
'plugin' => "grouper_lite",
- 'controller' => 'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'index',
'co' => $this->cur_co['Co']['id'],
'glid' => $id
diff --git a/Controller/GrouperGroupsController.php b/Controller/GrouperGroupsController.php
index 4dd3f1f..502c271 100644
--- a/Controller/GrouperGroupsController.php
+++ b/Controller/GrouperGroupsController.php
@@ -102,7 +102,7 @@ private function setConnection() {
*/
public function index() {
return $this->redirect(
- array('controller' => 'GrouperGroups', 'action' => 'groupoptin')
+ array('controller' => 'grouper_groups', 'action' => 'groupoptin')
);
}
@@ -137,6 +137,8 @@ public function groupInfo() {
$this->set('groupergroupssubscribers', array());
$this->Flash->set(_txt('pl.grouperlite.message.flash.group-detail-members-failed'), array('key' => 'error'));
}
+
+ $this->set('grouperbaseurl', $this->Session->read('Plugin.Grouper.Api.url'));
}
/**
@@ -178,8 +180,8 @@ public function groupOwner() {
//Set initial settings for pagination
$scope = [
'userId' => $this->userId,
- 'page' => ($this->passedArgs['page'] ? $this->passedArgs['page']: $this->paginate['page']),
- 'limit' => ($this->passedArgs['limit'] ? $this->passedArgs['limit']: $this->paginate['limit']),
+ 'page' => (isset($this->passedArgs['page']) ? $this->passedArgs['page']: $this->paginate['page']),
+ 'limit' => (isset($this->passedArgs['limit']) ? $this->passedArgs['limit']: $this->paginate['limit']),
];
if (isset($this->request->data['search'])) {
@@ -233,8 +235,8 @@ public function groupMember() {
//Set initial settings for pagination
$scope = [
'userId' => $this->userId,
- 'page' => ($this->passedArgs['page'] ? $this->passedArgs['page']: $this->paginate['page']),
- 'limit' => ($this->passedArgs['limit'] ? $this->passedArgs['limit']: $this->paginate['limit']),
+ 'page' => (isset($this->passedArgs['page']) ? $this->passedArgs['page']: $this->paginate['page']),
+ 'limit' => (isset($this->passedArgs['limit']) ? $this->passedArgs['limit']: $this->paginate['limit']),
];
if (isset($this->request->data['search'])) {
@@ -286,8 +288,8 @@ public function groupOptin() {
//Set initial settings for pagination
$scope = [
'userId' => $this->userId,
- 'page' => ($this->passedArgs['page'] ? $this->passedArgs['page']: $this->paginate['page']),
- 'limit' => ($this->passedArgs['limit'] ? $this->passedArgs['limit']: $this->paginate['limit']),
+ 'page' => (isset($this->passedArgs['page']) ? $this->passedArgs['page']: $this->paginate['page']),
+ 'limit' => (isset($this->passedArgs['limit']) ? $this->passedArgs['limit']: $this->paginate['limit']),
];
if (isset($this->request->data['search'])) {
@@ -337,31 +339,62 @@ public function groupOptin() {
* Editing via a template will not be supported in this version of the plugin - Bill Kaufman
*
*/
- public function groupCreateTemplateForm() {
+ public function groupCreateTemplate() {
if ($this->request->is('post')){
- if(!$this->GrouperGroup->createGroupFromTemplate($this->userId, $this->request->data)){
+ if(!$this->GrouperGroup->createGroupWithTemplate($this->userId, $this->request->data)){
$this->Flash->set("Error in creating group!", array('key' => 'error'));
return $this->redirect(array('action' => 'groupoptin'));
+ } else {
+ $this->Flash->set("Success in creating group!", array('key' => 'success'));
+ return $this->redirect(array('action' => 'groupoptin'));
}
}
$this->set('title', _txt('pl.grouperlite.title.templatecreate'));
}
+ /**
+ * Delete a Grouper Group via Grouper Template
+ *
+ */
+ public function groupDeleteTemplate() {
+ if(!$this->GrouperGroup->deleteGroupWithTemplate($this->userId, $this->request->data)){
+ $this->Flash->set("Error in deleting group!", array('key' => 'error'));
+ return $this->redirect(array('action' => 'groupoptin'));
+ }
+
+ $this->set('title', _txt('pl.grouperlite.title.templatecreate'));
+ }
+
+
+ public function groupCreate() {
+ if ($this->request->is('post')){
+ if(!$this->GrouperGroup->createUpdateGroup($this->userId, $this->request->data)){
+ $this->Flash->set("Error in creating group!", array('key' => 'error'));
+ return $this->redirect(array('action' => 'groupOwner'));
+ } else {
+ $this->Flash->set("Your Group has been created!", array('key' => 'success'));
+ return $this->redirect(array('action' => 'groupOwner'));
+ }
+ }
- //TODO - Need to combine this form with code below for groupCreate
- public function groupCreateForm() {
$this->set('title', _txt('pl.grouperlite.title.groupcreate'));
$this->set('grouperstems', $this->GrouperGroup->getOwnedStems($this->userId));
}
- public function groupCreate() {
- $name = urldecode($this->request->data['name']);
- $set = urldecode($this->request->data['set']);
- $descr = urldecode($this->request->data['description']);
- // Debugger::dump($this->request->data);
- $this->set('groupergroupadded', $this->GrouperGroup->createGroup($this->userId, $name, $set, $descr));
+ //TODO - Finish this call
+ public function groupDelete() {
+ if(!$this->GrouperGroup->deleteGroup($this->userId, $this->request->data)){
+ $this->Flash->set("Error in deleting group!", array('key' => 'error'));
+ return $this->redirect(array('action' => 'groupOwner'));
+ } else {
+ $this->Flash->set("Your Group has been deleted!", array('key' => 'success'));
+ return $this->redirect(array('action' => 'groupOwner'));
+ }
+
+ $this->set('grouperstems', $this->GrouperGroup->getOwnedStems($this->userId));
}
+
/**
* Process to join a group displayed on the "Optin" page
*
@@ -430,11 +463,19 @@ public function leaveGroup() {
function isAuthorized() {
$roles = $this->Role->calculateCMRoles();
- //Need to pull in UserID for access to Grouper
+ //This call just pulls in user ID from comanage but not Grouper, need the Grouper Id for API calls.
+
if ($this->Session->check('Auth.User.username')) {
$this->userId = $this->Session->read('Auth.User.username');
}
-
+/*
+ if ($this->Session->check('Plugin.Grouper.UserId')) {
+ $this->userId = $this->Session->read('Plugin.Grouper.UserId');
+ } else {
+ $this->userId = $this->GrouperGroup->getGrouperUserId();
+ $this->Session->write('Plugin.Grouper.UserId', $this->userId);
+ }
+*/
// Determine what operations this user can perform
// Construct the permission set for this user, which will also be passed to the view.
@@ -451,11 +492,11 @@ function isAuthorized() {
$p['emaillistsmember'] = true;
$p['emaillistsmanage'] = true;
$p['emaillistsinfo'] = true;
- $p['groupcreateform'] = true;
$p['groupcreate'] = true;
+ $p['groupdelete'] = true;
$p['joingroup'] = true;
$p['leavegroup'] = true;
- $p['groupcreatetemplateform'] = true;
+ $p['groupcreatetemplate'] = true;
$this->set('permissions', $p);
@@ -464,13 +505,27 @@ function isAuthorized() {
public function emaillistsOptin() {
$this->set('title', _txt('pl.grouperlite.title.emaillists-join'));
- // mock data
- $this->set('group', array(
- 'member' => true,
- 'name' => 'Email List 1',
- 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
- 'enabled' => 'T'
- ));
+
+ //Set initial settings for pagination
+ $scope = [
+ 'userId' => $this->userId,
+ 'page' => (isset($this->passedArgs['page']) ? $this->passedArgs['page']: $this->paginate['page']),
+ 'limit' => (isset($this->passedArgs['limit']) ? $this->passedArgs['limit']: $this->paginate['limit']),
+ ];
+
+ try {
+ //Add settings for optinEmailLists
+ $scope['method'] = 'optinEmailGroups';
+
+ $data = $this->Paginator->paginate('GrouperGroup', $scope);
+ $this->set('emailgroups', $data);
+
+ } catch (Exception $e) {
+ CakeLog::write('error', __METHOD__ . ': ' . var_export($e->getMessage(), true));
+ $this->Flash->set("An error occurred with the Optin Groups, please try again later.", array('key' => 'error'));
+ $this->set('emailgroups', array());
+ return;
+ }
$this->set('isuserowner', $this->GrouperGroup->isUserOwner($this->userId));
$this->set('isTemplateUser', $this->GrouperGroup->isTemplateUser($this->userId));
@@ -479,19 +534,34 @@ public function emaillistsOptin() {
public function emaillistsMember()
{
$this->set('title', _txt('pl.grouperlite.title.emaillists-member'));
- // mock data
- $this->set('group', array(
- 'member' => true,
- 'name' => 'Email List 1',
- 'domain' => 'internet2',
- 'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
- 'enabled' => 'T'
- ));
+
+ //Set initial settings for pagination
+ $scope = [
+ 'userId' => $this->userId,
+ 'page' => (isset($this->passedArgs['page']) ? $this->passedArgs['page']: $this->paginate['page']),
+ 'limit' => (isset($this->passedArgs['limit']) ? $this->passedArgs['limit']: $this->paginate['limit']),
+ ];
+
+ try {
+ //Add setting for Group Membership
+ $scope['method'] = 'filteredMemberOfEmails';
+
+ $data = $this->Paginator->paginate('GrouperGroup', $scope);
+ $this->set('emailgroups', $data);
+
+ } catch (Exception $e) {
+ CakeLog::write('error', __METHOD__ . ': ' . var_export($e->getMessage(), true));
+
+ $this->Flash->set("Your Member Group cannot be found, please try again later.", array('key' => 'error'));
+ $this->set('emailgroups', array());
+ return;
+ }
$this->set('isuserowner', $this->GrouperGroup->isUserOwner($this->userId));
$this->set('isTemplateUser', $this->GrouperGroup->isTemplateUser($this->userId));
}
+
public function emaillistsManage() {
$this->set('title', _txt('pl.grouperlite.title.emaillists-manage'));
// mock data
@@ -523,5 +593,7 @@ public function emaillistInfo() {
'enabled' => 'T',
'attributes' => array()
));
+ $this->set('grouperbaseurl', $this->Session->read('Plugin.Grouper.Api.url'));
+
}
}
diff --git a/Lib/GrouperApiAccess.php b/Lib/GrouperApiAccess.php
index 87d1de4..67fad1e 100644
--- a/Lib/GrouperApiAccess.php
+++ b/Lib/GrouperApiAccess.php
@@ -71,16 +71,13 @@ public function __construct() {
}
/**
- * NOT BEING USED
* Get User information from Grouper Web Service
*
- * @param array $queryData Array of conditions for querying
- * @return array
+ * @return String User ID in Grouper Groups
* @throws Exception
*/
- public function getGrouperUser(array $queryData) {
+ public function getGrouperUserId() {
- $userId = $queryData['userId'];
$this->http->setHeader(array('Content-Type' => 'application/json', 'Accept' => 'application/json'));
// Create attributes want returned from call to Grouper WS
@@ -94,7 +91,7 @@ public function getGrouperUser(array $queryData) {
'givenname'
),
'wsSubjectLookups' => array(
- array('subjectIdentifier' => $userId)
+ array('subjectIdentifier' => $_SERVER['REMOTE_USER'])
)
)
);
@@ -114,7 +111,7 @@ public function getGrouperUser(array $queryData) {
throw $e;
}
- return array();
+ return '';
}
/**
@@ -367,55 +364,74 @@ private function useMembershipUrl(array $queryData) {
}
}
+
/**
- * Returns a Distinct Grouper Group with its associated values
+ * Method used to CREATE a new Group in Grouper via the Template method.
*
- * @param array $queryData Array of conditions for querying
- * @return array Array of attributes for a Group
+ * @param array $queryData Array of conditions and data adding new Grouper Group
+ * @return bool True if added successfully
* @throws GrouperLiteException
+ *
*/
- public function getGrouperGroupDescription(array $queryData) {
- $groupName = $queryData['groupName'];
+ public function createGroupWithTemplate(array $queryData) {
+ //Currently only supporting create group, need to test if update a group will work!
+
+ $data = $queryData['data'];
+ $userId = $queryData['userId'];
//Build request logic
- $groupName = urlencode($groupName);
- $connectionUrl = "{$this->config['fullUrl']}/groups/{$groupName}/memberships";
+ $inputFields = array();
+ foreach($data as $key => $value) {
+ $inputFields[] = array('name' => $key, 'value' => $value);
+ }
+
+ $groupToSave = array(
+ "WsRestGshTemplateExecRequest" => array(
+ "gshTemplateActAsSubjectLookup" => array(
+ "subjectSourceId" => "ldap",
+ "subjectId" => $userId
+ ),
+ "ownerStemLookup" => array(
+ "stemName" => "ref:incommon-collab"
+ ),
+ "ownerType" => "stem",
+ "configId" => "createNewWorkingGroup",
+ "inputs" => $inputFields
+ )
+ );
+
+ $this->http->setHeader(array('Content-Type' => 'application/json', 'Accept' => 'application/json'));
+ $connectionUrl = "{$this->config['fullUrl']}/gshTemplateExec";
try {
- $results = $this->http->sendRequest('GET', $connectionUrl);
+ $results = $this->http->sendRequest('POST', $connectionUrl, json_encode($groupToSave));
- if (isset($results['WsGetMembershipsResults']['wsGroups']) && $results['WsGetMembershipsResults']['wsGroups'] != NULL) {
- return $results['WsGetMembershipsResults']['wsGroups'];
+ if (isset($results['WsGshTemplateExecResult']['resultMetadata']['resultCode'])) {
+ if (stripos($results['WsGshTemplateExecResult']['resultMetadata']['resultCode'], "SUCCESS", 0) !== false) {
+ return true;
+ }
}
} catch (Exception $e) {
CakeLog::write('error', __METHOD__ . ': An error occurred');
throw $e;
}
- return array();
+ return false;
}
/**
- * Method used to create a new Group in Grouper via the Template method.
+ * Method used to DELETE a Group in Grouper via the Template method.
*
* @param array $queryData Array of conditions and data adding new Grouper Group
- * @return bool True if added successfully
+ * @return bool True if deleted successfully
* @throws GrouperLiteException
*
*/
- public function createGroupFromTemplate(array $queryData) {
- //Currently only supporting create group, need to test if update a group will work!
+ public function deleteGroupWithTemplate(array $queryData) {
- $data = $queryData['data'];
+ $workingGroupExt = $queryData['workingGroupExt'];
$userId = $queryData['userId'];
-
- //Build request logic
- $inputFields = array();
- foreach($data as $key => $value) {
- $inputFields[] = array('name' => $key, 'value' => $value);
- }
-
- $groupToSave = array(
+ $groupToDelete = array(
"WsRestGshTemplateExecRequest" => array(
"gshTemplateActAsSubjectLookup" => array(
"subjectSourceId" => "ldap",
@@ -425,20 +441,21 @@ public function createGroupFromTemplate(array $queryData) {
"stemName" => "ref:incommon-collab"
),
"ownerType" => "stem",
- "configId" => "createNewWorkingGroup",
- "inputs" => $inputFields
+ "configId" => "createWorkingGroup",
+ "inputs" => array(
+ array(
+ "name" => "gsh_input_workingGroupExtension",
+ "value" => $workingGroupExt
+ )
+ )
)
);
- echo json_encode($groupToSave);
- exit();
- //TODO - take out exit and finish by running an example through
-
$this->http->setHeader(array('Content-Type' => 'application/json', 'Accept' => 'application/json'));
$connectionUrl = "{$this->config['fullUrl']}/gshTemplateExec";
try {
- $results = $this->http->sendRequest('POST', $connectionUrl, json_encode($groupToSave));
+ $results = $this->http->sendRequest('POST', $connectionUrl, json_encode($groupToDelete));
if (isset($results['WsGshTemplateExecResult']['resultMetadata']['resultCode'])) {
if (stripos($results['WsGshTemplateExecResult']['resultMetadata']['resultCode'], "SUCCESS", 0) !== false) {
@@ -453,7 +470,7 @@ public function createGroupFromTemplate(array $queryData) {
}
/**
- * NOTE: This will probably changes once templates become available to use
+ * For creating/updating Ad-Hoc groups not using the Grouper Template format
*
* Create or Update a Group where User is Admin/Owner
*
@@ -462,15 +479,19 @@ public function createGroupFromTemplate(array $queryData) {
* @throws GrouperLiteException
*/
public function createUpdateGroup(array $queryData) {
- //TODO - Need to add checking for missing ':'
- //Currently only supporting create group, need to test if update a group will work!
+ //TODO Currently only supporting create group, need to test if update a group will work!
- $groupName = $queryData['groupName'];
- $stemName = $queryData['stemName'];
+ $groupName = htmlentities($queryData['name']);
+ $stemName = htmlentities($queryData['stem']);
$userId = $queryData['userId'];
- $groupDescription = $queryData['groupDescription'];
+ $groupDescription = htmlentities($queryData['description']);
+ $privileges = $queryData['privileges'];
+
+ //Group name may be in "friendly" format, so need to do some small conversions before saving.
+ $newGroupName = ucfirst(strtolower($groupName));
+ $newGroupName = str_replace(' ', '', $newGroupName);
- $newGroupToSave = $stemName . $groupName;
+ $newGroupToSave = "$stemName:$newGroupName";
//Build request logic
$groupToSave = array(
@@ -482,7 +503,8 @@ public function createUpdateGroup(array $queryData) {
array(
"wsGroup" => array(
"description" => $groupDescription,
- "name" => $newGroupToSave
+ "name" => $newGroupToSave,
+ "displayExtension" => $groupName
),
"wsGroupLookup" => array(
"groupName" => $groupDescription
@@ -510,15 +532,15 @@ public function createUpdateGroup(array $queryData) {
}
/**
- * Listing of attributes in Grouper for a given Group Name
+ * Grouper Group information plus a listing of attributes in Grouper for that given Group
*
* @param array $queryData Array of conditions for querying
* @return array Record of Grouper attributes for given GroupName
* @throws GrouperLiteException
*/
- public function getGroupAttributes(array $queryData) {
- // Need to pass in the full stem path, so thing like sandbox:app:sympa are good!
+ public function getGrouperGroupInfo(array $queryData) {
$groupName = $queryData['groupName'];
+ $groupInfo = array();
//Build request logic
$stemToFind = array(
@@ -538,14 +560,21 @@ public function getGroupAttributes(array $queryData) {
try {
$results = $this->http->sendRequest('POST', $connectionUrl, json_encode($stemToFind));
+ //Get the group information
+ if (isset($results['WsGetAttributeAssignmentsResults']['wsGroups']) && $results['WsGetAttributeAssignmentsResults']['wsGroups'] != NULL) {
+ $groupInfo = $results['WsGetAttributeAssignmentsResults']['wsGroups'];
+ }
+
+ //Now get the Group Attributes and add them to group
if (isset($results['WsGetAttributeAssignmentsResults']['wsAttributeAssigns']) && $results['WsGetAttributeAssignmentsResults']['wsAttributeAssigns'] != NULL) {
- return $results['WsGetAttributeAssignmentsResults']['wsAttributeAssigns'];
+ $groupInfo[0]["attributes"] = $results['WsGetAttributeAssignmentsResults']['wsAttributeAssigns'];
}
+
+ return $groupInfo;
} catch (Exception $e) {
CakeLog::write('error', __METHOD__ . ': An error occurred');
throw $e;
}
- return array();
}
}
diff --git a/Lib/lang.php b/Lib/lang.php
index cecac6e..943488d 100644
--- a/Lib/lang.php
+++ b/Lib/lang.php
@@ -16,6 +16,7 @@
'pl.grouperlite.nav.emaillists-member' => 'My email lists',
'pl.grouperlite.nav.emaillists-manage' => 'Email lists I manage',
'pl.grouperlite.nav.create-group' => 'Create group',
+ 'pl.grouperlite.nav.create-working-group' => 'Create working group',
'pl.grouperlite.nav.create-email' => 'Create email list',
'pl.grouperlite.nav.emaillists' => 'Email Lists',
'pl.grouperlite.nav.groups' => 'Groups',
@@ -131,5 +132,6 @@
'pl.grouperlite.search.tags.text' => 'Search',
- 'pl.grouperlite.pagination.counter' => 'Viewing {:start}-{:end} of {:count}'
+ 'pl.grouperlite.pagination.counter' => 'Viewing {:start}-{:end} of {:count}',
+ 'pl.grouperlite.attributes.zero-state' => 'No Attributes Associated to this Group.'
);
\ No newline at end of file
diff --git a/Model/GrouperGroup.php b/Model/GrouperGroup.php
index e8d14e2..fb3c7f4 100644
--- a/Model/GrouperGroup.php
+++ b/Model/GrouperGroup.php
@@ -47,6 +47,7 @@ class GrouperGroup extends GrouperLiteAppModel
/** @var string Group whose members can create Groups via Template process*/
private $templateCreationGroup = 'ref:workinggroupadmins';
+
/**
* Verifies if user is an owner/admin of a group and then stores results in Session.
* Session variable is reset on Group Creation and Group Deletion
@@ -84,6 +85,7 @@ public function isUserOwner(string $userId) {
}
}
+
/**
* Used to instantiate API class
*
@@ -98,6 +100,24 @@ private function initApi() {
}
}
+ /**
+ * Gets the users Id from Grouper since can be different than what is in Comanage.
+ *
+ * @return String User's Id in Grouper
+ * @throws Exception
+ */
+ public function getGrouperUserId() {
+ $this->initApi();
+
+ try {
+ return $this->grouperAPI->getGrouperUserId();
+
+ } catch (Exception $e) {
+ CakeLog::write('error', __METHOD__ . ': An error occurred');
+ throw $e;
+ }
+ }
+
/**
* Return all Groups that a User belongs to in Grouper.
* Will also add Optin Groups and flag them as joined so can display Optout option in UI.
@@ -136,6 +156,19 @@ public function filteredMemberOfGroups(array $conditions) {
}
}
+ public function filteredMemberOfEmails(array $conditions) {
+ $memberOfEmails = $this->filteredMemberOfGroups($conditions);
+
+ // Strip out all Groups that are not in Sympa Stem/Directory
+ foreach($memberOfEmails as $key => $value){
+ if(strpos($value['name'], 'sympa') === false) {
+ unset($memberOfEmails[$key]);
+ }
+ }
+
+ return $memberOfEmails;
+ }
+
/**
* Internal process used by other functions to fetch Groups the User is a member of
*
@@ -212,14 +245,9 @@ public function groupDescriptions(string $groupName) {
$args = array();
$args['groupName'] = $groupName;
- $groupDescription = $this->grouperAPI->getGrouperGroupDescription($args);
+ $groupDescription = $this->grouperAPI->getGrouperGroupInfo($args);
$groupInfo = $this->getFriendlyName($groupDescription);
- //make call to get attributes for group
- $grouperAtt = new GrouperAttribute();
- $groupAttributes = $grouperAtt->getGroupAttributes($groupName);
-
- $groupInfo[0]["attributes"] = $groupAttributes;
return $groupInfo;
} catch (Exception $e) {
@@ -360,6 +388,19 @@ public function optinGroups(array $conditions) {
}
}
+ public function optinEmailGroups(array $conditions) {
+ $allGroups = $this->optinGroups($conditions);
+
+ // Strip out all Groups that are not in Sympa Stem/Directory
+ foreach($allGroups as $key => $value){
+ if(strpos($value['name'], 'sympa') === false) {
+ unset($allGroups[$key]);
+ }
+ }
+
+ return $allGroups;
+ }
+
/**
* Determine if User can use the Grouper Template to create a suite of Groups including Email lists.
*
@@ -413,7 +454,7 @@ public function isTemplateUser(string $userId) {
* @throws GrouperLiteException
*
*/
- public function createGroupFromTemplate(string $userId, array $groupData) {
+ public function createGroupWithTemplate(string $userId, array $groupData) {
$this->initApi();
try {
@@ -437,7 +478,36 @@ public function createGroupFromTemplate(string $userId, array $groupData) {
// Reset Session variable that shows if User is an owner or not
$this->resetUserOwner();
- return $this->grouperAPI->createGroupFromTemplate($args);
+ return $this->grouperAPI->createGroupWithTemplate($args);
+
+ } catch (Exception $e) {
+ CakeLog::write('error', __METHOD__ . ': An error occurred');
+ throw $e;
+ }
+
+ }
+
+ /**
+ * Delete a Grouper Group using the Template methodology in Grouper
+ *
+ * @param string $userId Id of User
+ * @param array $groupData Data needed to delete a Grouper Group via Template
+ * @return bool True if successfully deleted record
+ * @throws GrouperLiteException
+ *
+ */
+ public function deleteGroupWithTemplate(string $userId, array $groupData) {
+ $this->initApi();
+
+ try {
+ $args = array();
+ $args['userId'] = $userId;
+ $args['workingGroupExt'] = $groupData['workingGroupExt'];
+
+ // Reset Session variable that shows if User is an owner or not
+ $this->resetUserOwner();
+
+ return $this->grouperAPI->deleteGroupWithTemplate($args);
} catch (Exception $e) {
CakeLog::write('error', __METHOD__ . ': An error occurred');
@@ -447,26 +517,20 @@ public function createGroupFromTemplate(string $userId, array $groupData) {
}
/**
- * Creates a new Grouper Group
+ * Creates/Updates a new Grouper Group not Template related
*
* @param string $userId Id of user
- * @param string $groupName Display Name of Group creating, do not confuse with Name field that is ID!
- * @param string $stemName Full Stem (Folder) Name in format of 'stem:substem:subsubstem'
- * @param string $groupDesc Description of Group creating
+ * @param array $data Data from form to Save in Grouper as a Group
* @return bool True if saved | False if already created
* @throws GrouperLiteException
*
*/
- public function createGroup(string $userId, string $groupName, string $stemName, string $groupDesc) {
+ public function createUpdateGroup(string $userId, array $data) {
$this->initApi();
try {
- $args = array();
- $args['groupType'] = 'Optins';
+ $args = $data;
$args['userId'] = $userId;
- $args['groupName'] = $groupName;
- $args['stemName'] = $stemName;
- $args['groupDescription'] = $groupDesc;
// Reset Session variable that shows if User is an owner or not
$this->resetUserOwner();
diff --git a/View/CoGrouperLites/display.ctp b/View/CoGrouperLites/display.ctp
index 3a56e7f..e8f38ac 100644
--- a/View/CoGrouperLites/display.ctp
+++ b/View/CoGrouperLites/display.ctp
@@ -53,7 +53,7 @@ echo $this->element('GrouperLite.base-styles');
'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'groupoptin',
'co' => $coid,
'glid' => $glid
@@ -64,7 +64,7 @@ echo $this->element('GrouperLite.base-styles');
'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'groupmember',
'co' => $coid,
'glid' => $glid
@@ -76,7 +76,7 @@ echo $this->element('GrouperLite.base-styles');
'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'groupowner',
'co' => $coid,
'glid' => $glid
@@ -93,7 +93,7 @@ echo $this->element('GrouperLite.base-styles');
'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'emaillistsoptin',
'co' => $coid,
'glid' => $glid
@@ -104,7 +104,7 @@ echo $this->element('GrouperLite.base-styles');
'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'emaillistsMember',
'co' => $coid,
'glid' => $glid
@@ -116,7 +116,7 @@ echo $this->element('GrouperLite.base-styles');
'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'emaillistsManage',
'co' => $coid,
'glid' => $glid
diff --git a/View/Elements/Components/groupattributes.ctp b/View/Elements/Components/groupattributes.ctp
index f4589db..67019c8 100644
--- a/View/Elements/Components/groupattributes.ctp
+++ b/View/Elements/Components/groupattributes.ctp
@@ -1,27 +1,28 @@
0) : ?>
-
-
-
- |
- |
- |
-
-
-
-
+
+
- |
- |
-
-
-
-
- |
+ |
+ |
+ |
-
-
-
-
+
+
+
+
+ |
+ |
+
+
+
+
+ |
+
+
+
+
+
+
diff --git a/View/Elements/Components/navigation-emaillists.ctp b/View/Elements/Components/navigation-emaillists.ctp
index 7597315..60b3856 100644
--- a/View/Elements/Components/navigation-emaillists.ctp
+++ b/View/Elements/Components/navigation-emaillists.ctp
@@ -5,7 +5,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.emaillists-join'),
array(
- 'controller' => 'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'emaillistsoptin'
),
array('class' => array('nav-link', $active == 'emaillistsoptin' ? 'active' : ''))
@@ -17,7 +17,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.emaillists-member'),
array(
- 'controller' => 'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'emaillistsmember'
),
array('class' => array('nav-link', $active == 'emaillistsmember' ? 'active' : ''))
@@ -29,7 +29,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.emaillists-manage'),
array(
- 'controller' => 'GrouperGroups',
+ 'controller' => 'grouper_groups',
'action' => 'emaillistsmanage'
),
array('class' => array('nav-link', $active == 'emaillistsmanage' ? 'active' : ''))
@@ -42,7 +42,7 @@
Html->url(
array(
- 'controller' => 'groupergroups',
+ 'controller' => 'grouper_groups',
'action' => 'groupcreatetemplateform'
)
);
@@ -56,7 +56,7 @@
Html->url(
array(
- 'controller' => 'groupergroups',
+ 'controller' => 'grouper_groups',
'action' => 'groupoptin'
)
);
diff --git a/View/Elements/Components/navigation-groups.ctp b/View/Elements/Components/navigation-groups.ctp
index 636e6c4..aadcef4 100644
--- a/View/Elements/Components/navigation-groups.ctp
+++ b/View/Elements/Components/navigation-groups.ctp
@@ -5,7 +5,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.groups-can-join'),
array(
- 'controller' => 'groupergroups',
+ 'controller' => 'grouper_groups',
'action' => 'groupoptin'
),
array('class' => array('nav-link', $active == 'groupoptin' ? 'active' : ''))
@@ -17,7 +17,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.memberships'),
array(
- 'controller' => 'groupergroups',
+ 'controller' => 'grouper_groups',
'action' => 'groupmember'
),
array('class' => array('nav-link', $active == 'groupmember' ? 'active' : ''))
@@ -29,7 +29,7 @@
print $this->Html->link(
_txt('pl.grouperlite.nav.groups-presided'),
array(
- 'controller' => 'groupergroups',
+ 'controller' => 'grouper_groups',
'action' => 'groupowner'
),
array('class' => array('nav-link', $active == 'groupowner' ? 'active' : ''))
@@ -42,8 +42,8 @@
Html->url(
array(
- 'controller' => 'groupergroups',
- 'action' => 'groupcreateform'
+ 'controller' => 'grouper_groups',
+ 'action' => 'groupcreate'
)
);
?>
@@ -52,11 +52,26 @@
+
+
+ Html->url(
+ array(
+ 'controller' => 'grouper_groups',
+ 'action' => 'groupcreatetemplate'
+ )
+ );
+ ?>
+
+
+
+
+
Html->url(
array(
- 'controller' => 'groupergroups',
+ 'controller' => 'grouper_groups',
'action' => 'emaillistsoptin'
)
);
diff --git a/View/Elements/Components/optAction.ctp b/View/Elements/Components/optAction.ctp
index 2928dca..6ac08f5 100644
--- a/View/Elements/Components/optAction.ctp
+++ b/View/Elements/Components/optAction.ctp
@@ -1,5 +1,5 @@
Form->create(false, array(
- 'url' => array('controller' => 'groupergroups', 'action' => $action),
+ 'url' => array('controller' => 'grouper_groups', 'action' => $action),
'class' => 'd-flex justify-content-center'
)); ?>
Form->hidden('GroupName', array('default' => $group)); ?>
diff --git a/View/Elements/Components/search.ctp b/View/Elements/Components/search.ctp
index 37c1491..acd9fe7 100644
--- a/View/Elements/Components/search.ctp
+++ b/View/Elements/Components/search.ctp
@@ -16,7 +16,7 @@
});
Form->create(false, array(
- 'url' => array('controller' => 'groupergroups', 'action' => $active),
+ 'url' => array('controller' => 'grouper_groups', 'action' => $active),
'class' => 'search mb-4'
)); ?>