diff --git a/Controller/GrouperGroupsController.php b/Controller/GrouperGroupsController.php index 14949aa..7859c04 100644 --- a/Controller/GrouperGroupsController.php +++ b/Controller/GrouperGroupsController.php @@ -65,6 +65,8 @@ public function beforeFilter() { parent::beforeFilter(); + $this->Security->unlockedActions = array('removeSubscriber', 'addSubscriber'); + //Need to find which plugin instance choosing, if more than one from cm_co_grouper_lites // table being used in COmanage. $grouperConnData = $this->Session->read('Plugin.Grouper.Api'); @@ -766,16 +768,16 @@ function isAuthorized() //TODO - This is needed for my dev enviro since I do not log in via I2 IdP // BEGIN =============================================== -// if ($this->Session->check('Auth.User.username')) { -// $this->userId = $this->Session->read('Auth.User.username'); -// } + if ($this->Session->check('Auth.User.username')) { + $this->userId = $this->Session->read('Auth.User.username'); + } // END =============================================== //TODO - Need to make the following code configurable in getting the user ID. In this case the code is // specific to the needs of I2. // BEGIN =============================================== - $uid=$this->Session->read('Auth.User.co_person_id'); + /*$uid=$this->Session->read('Auth.User.co_person_id'); $username=$this->Session->read('Auth.User.username'); error_log("HUBING ================ " . $username); @@ -815,6 +817,7 @@ function isAuthorized() $this->Session->write('Plugin.Grouper.UserId', $this->userId); } // END =============================================== + */ // Determine what operations this user can perform // Construct the permission set for this user, which will also be passed to the view. diff --git a/Lib/GrouperApiAccess.php b/Lib/GrouperApiAccess.php index d6b1d58..b9e2770 100644 --- a/Lib/GrouperApiAccess.php +++ b/Lib/GrouperApiAccess.php @@ -403,7 +403,7 @@ private function useMembershipUrl(array $queryData) { $groupType = $queryData['groupType']; $userId = $queryData['userId']; - + if ($groupType == 'optins' || $groupType == 'optouts') { $subjectId = "GrouperAll"; } elseif ($groupType == 'admin' || $groupType == 'update' || $groupType == 'stemAdmin') { diff --git a/Lib/lang.php b/Lib/lang.php index fb67713..cc33a8d 100644 --- a/Lib/lang.php +++ b/Lib/lang.php @@ -159,5 +159,7 @@ 'pl.grouperlite.attributes.zero-state' => 'No Attributes Associated to this Group.', 'pl.grouperlite.groups.zero-state' => 'No groups found.', 'pl.grouperlite.working-groups.zero-state' => 'None.', - 'pl.grouperlite.email-lists.zero-state' => 'No email lists found.' + 'pl.grouperlite.email-lists.zero-state' => 'No email lists found.', + 'pl.grouperlite.members.noaccess' => 'You do not have access to view memberships.', + 'pl.grouperlite.members.empty' => 'This group has no members.' ); \ No newline at end of file diff --git a/View/Elements/Components/subscriberList.ctp b/View/Elements/Components/subscriberList.ctp index 9ea20b9..100673e 100644 --- a/View/Elements/Components/subscriberList.ctp +++ b/View/Elements/Components/subscriberList.ctp @@ -140,20 +140,12 @@ $("#addUser").val(ui.item.identifier); // $("#CoGroupMemberCoPersonLabel").val(ui.item.label); $("#addUserbutton").prop('disabled', false).focus(); - $("#group-add-member-clear-button").show(); return false; }, - search: function(event, ui) { - $("#group-add-member-search-container .co-loading-mini").show(); - }, focus: function(event, ui) { event.preventDefault(); - $("#group-add-member-search-container .co-loading-mini").hide(); $("#group-add-member").val(ui.item.label + " (" + ui.item.value + ")"); }, - close: function(event, ui) { - $("#group-add-member-search-container .co-loading-mini").hide(); - } }).autocomplete("instance")._renderItem = formatCoPersonAutoselectItem; } diff --git a/View/Elements/Components/vue-table.ctp b/View/Elements/Components/vue-table.ctp new file mode 100644 index 0000000..337633b --- /dev/null +++ b/View/Elements/Components/vue-table.ctp @@ -0,0 +1,118 @@ + + + + +
+ element("pagination", array( + 'goto' => false, + 'limit' => false, + 'numbers' => false, + 'counter' => true, + 'class' => 'counter' + )); ?> +
+ + + +
+ + element("pagination", array( + 'goto' => false, + 'limit' => true, + 'numbers' => true, + 'counter' => false + )); ?> +
diff --git a/View/GrouperGroups/base.ctp b/View/GrouperGroups/base.ctp index 3242b27..7ffa91f 100644 --- a/View/GrouperGroups/base.ctp +++ b/View/GrouperGroups/base.ctp @@ -1,5 +1,3 @@ - - Html->meta( @@ -23,7 +21,7 @@ print $this->Html->css('GrouperLite.co-grouper-plugin') . "\n "; print $this->Html->script('vue/vue-3.2.31.global.prod.js'); ?> - +element('GrouperLite.Components/plugins'); ?> Html->addCrumb(_txt('pl.grouperlite.crumb.root'), array('controller' => 'grouper_groups', 'action' => 'groupmember'), array('prepend' => true)); diff --git a/View/GrouperGroups/groupmember.ctp b/View/GrouperGroups/groupmember.ctp index ce7f61e..3d218f9 100644 --- a/View/GrouperGroups/groupmember.ctp +++ b/View/GrouperGroups/groupmember.ctp @@ -3,119 +3,31 @@ Html->addCrumb(_txt('pl.grouperlite.nav.memberships')); ?> element('GrouperLite.Components/navigation-groups', array('active' => 'groupmember')); ?> element('GrouperLite.Components/search', array('active' => 'groupmember')); ?> - - - - - -
- element("pagination", array( - 'goto' => false, - 'limit' => false, - 'numbers' => false, - 'counter' => true, - 'class' => 'counter' - )); ?> -
- - - -
- - element("pagination", array( - 'goto' => false, - 'limit' => true, - 'numbers' => true, - 'counter' => false - )); ?> -
- +element('GrouperLite.Components/vue-table', array( + 'groupData' => json_encode(array( + 'adhoc' => $groupmemberships, + 'working' => $wgmemberships + )), + 'treatAsOwner' => $isuserowner === 'T' ? 'true' : 'false', + 'columns' => json_encode(array( + array('value' => 'name', 'label' => _txt('pl.grouperlite.table.name')), + array('value' => 'role', 'label' => _txt('pl.grouperlite.table.role')), + array('value' => 'description', 'label' => _txt('pl.grouperlite.table.description')), + array('value' => 'action', 'label' => _txt('pl.grouperlite.table.action')), + )), + 'collapsed' => $config['defaultCollapse'] === 'collapsed' ? true : false, + 'optAction' => "leavegroup", + 'actionUrl' => $this->Html->url([ + 'controller' => 'grouper_groups', 'action' => 'leavegroup' + ]), + 'members' => true, + 'addSubscribers' => true, +)); ?>

-element('Components/subscriberList', array('addSubscribers' => false)); ?> - \ No newline at end of file diff --git a/View/GrouperGroups/groupoptin.ctp b/View/GrouperGroups/groupoptin.ctp index 3cb1144..8bc5a62 100644 --- a/View/GrouperGroups/groupoptin.ctp +++ b/View/GrouperGroups/groupoptin.ctp @@ -3,88 +3,25 @@ Html->addCrumb(_txt('pl.grouperlite.nav.groups-can-join')); ?> element('GrouperLite.Components/navigation-groups', array('active' => 'groupoptin')); ?> element('GrouperLite.Components/search', array('active' => 'groupoptin')); ?> - 'pl.grouperlite.table.name', - // 'role' => 'pl.grouperlite.table.role', - 'description' => 'pl.grouperlite.table.description', - 'action' => 'pl.grouperlite.table.action' -]; - -if ($isuserowner !== 'T') { - // array_splice($columns, 1, 1); -} - -$numColumns = count($columns); - -$collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false; - -?> - 0) : ?> -
- element("pagination", array( - 'goto' => false, - 'limit' => false, - 'numbers' => false, - 'counter' => true, - 'class' => 'counter' - )); ?> - - - - $label) : ?> - - - - - - - - - $group) : ?> - - - - - - - - -
- -
- - - - - element('GrouperLite.Components/optAction', array( - 'member' => false, - 'action' => 'joingroup', - 'group' => $group['name'], - 'groupDisplay' => $group['friendlyName'], - 'idx' => $key - )); ?> -
- element("pagination", array( - 'goto' => false, - 'limit' => true, - 'numbers' => true, - 'counter' => false - )); ?> -
- - +element('GrouperLite.Components/vue-table', array( + 'groupData' => json_encode(array( + 'adhoc' => $groupoptins, + 'working' => array() + )), + 'treatAsOwner' => false, + 'columns' => json_encode(array( + array('value' => 'name', 'label' => _txt('pl.grouperlite.table.name')), + array('value' => 'description', 'label' => _txt('pl.grouperlite.table.description')), + array('value' => 'action', 'label' => _txt('pl.grouperlite.table.action')), + )), + 'collapsed' => $config['defaultCollapse'] === 'collapsed' ? true : false, + 'optAction' => "joingroup", + 'actionUrl' => $this->Html->url([ + 'controller' => 'grouper_groups', 'action' => 'joingroup' + ]), +)); ?>

- - \ No newline at end of file + \ No newline at end of file diff --git a/View/GrouperGroups/groupowner.ctp b/View/GrouperGroups/groupowner.ctp index 63176bd..6751105 100644 --- a/View/GrouperGroups/groupowner.ctp +++ b/View/GrouperGroups/groupowner.ctp @@ -4,117 +4,38 @@ element('Components/navigation-groups', array('active' => 'groupowner')); ?> element('Components/search', array('active' => 'groupowner')); ?> 'pl.grouperlite.table.name', - 'role' => 'pl.grouperlite.table.role', - 'description' => 'pl.grouperlite.table.description', - 'status' => 'pl.grouperlite.table.status', - 'action' => 'pl.grouperlite.table.action' -]; +$columns = array( + array('value' => 'name', 'label' => _txt('pl.grouperlite.table.name')), + array('value' => 'role', 'label' => _txt('pl.grouperlite.table.role')), + array('value' => 'description', 'label' => _txt('pl.grouperlite.table.description')), + array('value' => 'status', 'label' => _txt('pl.grouperlite.table.status')), + array('value' => 'action', 'label' => _txt('pl.grouperlite.table.action')), +); if ($isuserowner !== 'T') { array_splice($columns, 1, 1); } +?> + +element('GrouperLite.Components/vue-table', array( + 'groupData' => json_encode(array( + 'adhoc' => $groupsowners, + 'working' => array() + )), + 'treatAsOwner' => $isuserowner === 'T' ? 'true' : 'false', + 'columns' => json_encode($columns), + 'collapsed' => $config['defaultCollapse'] === 'collapsed' ? true : false, + 'optAction' => "leavegroup", + 'actionUrl' => $this->Html->url([ + 'controller' => 'grouper_groups', 'action' => 'leavegroup' + ]), + 'members' => true +)); ?> -$numColumns = count($columns); -$collapsed = $config['defaultCollapse'] === 'collapsed' ? true : false; -?> - 0) : ?> -
- element("pagination", array( - 'goto' => false, - 'limit' => false, - 'numbers' => false, - 'counter' => true, - 'class' => 'counter' - )); ?> - - - - $label) : ?> - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- You are not a manager of any ad-hoc groups. -
- - - - - - element('GrouperLite.Components/optAction', array( - 'member' => $group['optOut'], - 'action' => 'leavegroup', - 'group' => $group['name'], - 'groupDisplay' => $group['friendlyName'], - 'idx' => $key - )) : ''; ?> - - - - -   - - - - -
- element("pagination", array( - 'goto' => false, - 'limit' => true, - 'numbers' => true, - 'counter' => false - )); ?> -
- -

-element('Components/subscriberList', array('addSubscribers' => true)); ?> \ No newline at end of file diff --git a/webroot/js/autocomplete.js b/webroot/js/autocomplete.js new file mode 100644 index 0000000..f7a161d --- /dev/null +++ b/webroot/js/autocomplete.js @@ -0,0 +1,59 @@ +// ns.testeradmin@at.internet2.edu + +export default { + props: { + group: String + }, + inject: ['txt', 'api'], + data() { + return { + search: '', + test: [{ + "value": "8", + "label": "Susan S. Singularity", + "email": "ssingularity@another.org 1", + "emailLabel": "Email (official): ", + "identifier": "ssingularity@another.org", + "identifierLabel": "" + }, { + "value": "4", + "label": "Susan S. Susanity", + "email": "ssusanity@newbie.org 1", + "emailLabel": "Email (official): ", + "identifier": "ssingularity@another.org", + "identifierLabel": "" + }] + }; + }, + methods: { + addUser(search) { + this.$emit('add', search); + } + }, + mounted(el) { + const input = $(this.$el).find('#add-user-input'); + input.autocomplete({ + source: `${this.api.find}?co=${this.api.co}&mode=${this.api.mode}`, + // source: [].concat(this.test, this.test, this.test), + minLength: 3, + maxShowItems: 5, + select: (event, ui) => { + console.log(ui); + $("#add-user-input").val(ui.item.value); + $("#addUserbutton").prop('disabled', false).focus(); + return false; + }, + }); + }, + template: /*html*/` +
+ +
+ +
+
+ ` +} \ No newline at end of file diff --git a/webroot/js/grouper-groups-view.js b/webroot/js/grouper-groups-view.js index 275178e..7920461 100644 --- a/webroot/js/grouper-groups-view.js +++ b/webroot/js/grouper-groups-view.js @@ -1,5 +1,6 @@ import Collapse from './collapse.js'; import Popover from './popover.js'; +import Members from './members.js'; export default { props: { @@ -12,10 +13,12 @@ export default { }, url: String, owner: Boolean, - txt: Object, + grouper: String, }, + inject: ['txt'], components: { - Collapse + Collapse, + Members }, computed: { numColumns() { @@ -23,12 +26,24 @@ export default { }, collapsed() { return this.config.collapsed; + }, + role() { + return this.columns.some(c => c.value === 'role'); + }, + status() { + return this.columns.some(c => c.value === 'status'); } }, directives: { Popover }, + methods: { + showSubscribers(group) { + this.$refs.members.show(group); + } + }, template: /*html*/` + @@ -58,23 +73,36 @@ export default { + + - + -
{{ group.description || txt.descrZeroState }}{{ group.enabled && group.enabled === 'T' ? 'Enabled' : 'Disabled' }} - -
@@ -88,10 +116,10 @@ export default {
None