Skip to content

Commit

Permalink
Updates for bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Aug 4, 2023
1 parent 4cfa803 commit c881b29
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 171 deletions.
2 changes: 1 addition & 1 deletion Lib/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,5 @@
'pl.grouperlite.working-groups.zero-state' => 'None.',
'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.'
'pl.grouperlite.members.empty' => 'This group has no member OR you are not authorized to see the members of this group.'
);
19 changes: 6 additions & 13 deletions View/GrouperGroups/index.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,19 @@
<?php $this->extend('/GrouperGroups/base'); ?>
<?php print $this->Html->script('GrouperLite.vue-router.js'); ?>
<?php $this->Html->addCrumb(_txt('pl.grouperlite.nav.memberships')); ?>
<?php $treatAsOwner = $config['isuserowner'] !== 'T'; ?>
<?php $treatAsOwner = $config['isuserowner'] === 'T'; ?>
<!--/nocache-->

<div class="d-flex align-items-center mb-4">
<?php print $this->Html->image('GrouperLite.Grouper.jpg', array('class' => 'img-fluid mr-2', 'style' => 'height: 50px')); ?>
<h1 class="h2"><?php echo $title; ?></h1>
</div>

<script type="module">
<?php if(Configure::read('debug') > 0): ?>
import GrouperGroupsView from '<?php print $this->webroot ?>grouper_lite/js/grouper-groups-view.js?time=<?php print time()?>';
import GroupMember from '<?php print $this->webroot ?>grouper_lite/js/page/GroupMember.js?time=<?php print time()?>';
import GroupOptin from '<?php print $this->webroot ?>grouper_lite/js/page/GroupOptin.js?time=<?php print time()?>';
import GroupOwner from '<?php print $this->webroot ?>grouper_lite/js/page/GroupOwner.js?time=<?php print time()?>';
<?php else: ?>
import GrouperGroupsView from '<?php print $this->webroot ?>grouper_lite/js/grouper-groups-view.js';
import GroupMember from '<?php print $this->webroot ?>grouper_lite/js/page/GroupMember.js';
import GroupOptin from '<?php print $this->webroot ?>grouper_lite/js/page/GroupOptin.js';
import GroupOwner from '<?php print $this->webroot ?>grouper_lite/js/page/GroupOwner.js';
<?php endif; ?>
<?php $suffix = Configure::read('debug') > 0 ? '?time=' . time() : '' ?>
import GrouperGroupsView from '<?php print $this->webroot ?>grouper_lite/js/grouper-groups-view.js<?php print $suffix; ?>';
import GroupMember from '<?php print $this->webroot ?>grouper_lite/js/page/GroupMember.js<?php print $suffix; ?>';
import GroupOptin from '<?php print $this->webroot ?>grouper_lite/js/page/GroupOptin.js<?php print $suffix; ?>';
import GroupOwner from '<?php print $this->webroot ?>grouper_lite/js/page/GroupOwner.js<?php print $suffix; ?>';

<?php
$baseUrl = $config['grouperbaseurl'];
Expand Down
147 changes: 0 additions & 147 deletions webroot/js/grouper-groups-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,150 +69,3 @@ export default {
<router-view></router-view>
`
}

/*
<tabs :default-tab="page" @change="setPage">
<tab name="groupmember" :title="txt.tabs.memberships">
</tab>
<tab name="groupoptin" :title="txt.tabs.optin">
<groups :api-path="api.optin">
<template v-slot:searchResult="searchResult">
<pagination :records="searchResult.groups">
<template v-slot:paginated="paginated">
<page-count :first="paginated.start" :last="paginated.end" :total="paginated.total"></page-count>
<groups-table
:groups="paginated.records"
:columns="['name', 'description', 'action']"
@join-group="searchResult.join"></groups-table>
</template>
</pagination>
</template>
</groups>
</tab>
<tab name="groupowner" :title="txt.tabs.owner">
<groups :api-path="api.owner">
<template v-slot:searchResult="searchResult">
<pagination :records="searchResult.groups">
<template v-slot:paginated="paginated">
<page-count :first="paginated.start" :last="paginated.end" :total="paginated.total"></page-count>
<groups-table
:groups="paginated.records"
:columns="['name', 'role', 'description', 'status', 'action']"
:grouper="true"
@show-subscribers="showSubscribers"></groups-table>
</template>
</pagination>
</template>
</groups>
</tab>
</tabs>
<table class="table w-100 mb-0">
<thead>
<tr>
<th v-for="column in this.cols" class="group" :class="[column.value, { 'text-center': column.value === 'action' }]">{{ column.label }}</th>
</tr>
</thead>
<tbody>
<collapse :default="config.collapsed" v-slot="{toggle, show}">
<tr class="table-secondary">
<td :colspan="numColumns">
<button type="button"
class="btn btn-link btn-text collapse-btn fw-bold m-0"
@click="toggle"
role="button"
:aria-expanded="[!show ? 'false' : 'true']">
{{ config.adhocHeading }}
<em class="material-icons mt-0" aria-hidden="true">{{ !show ? 'arrow_right' : 'arrow_drop_down' }}</em>
</button>
</td>
</tr>
<template v-if="show">
<tr v-for="group in this.groups.adhoc" class="collapse-adhoc-group-parent">
<td class="pl-3" v-if="tab.columns.indexOf('name') > -1">
<span v-popover="group.name" class="grpr-popover-toggle">
{{ group.friendlyName || 'No Name' }}
</span>
</td>
<td v-if="tab.columns.indexOf('role') > -1">&mdash;</td>
<td v-if="tab.columns.indexOf('description') > -1">{{ group.description || txt.descrZeroState }}</td>
<td v-if="tab.columns.indexOf('status') > -1">{{ group.enabled && group.enabled === 'T' ? 'Enabled' : 'Disabled' }}</td>
<td>
<span class="d-flex flex-row justify-content-center align-items-center">
<template v-if="showOptAction(group)">
<slot name="actionform"
:groupname="group.name"
:groupdisplayname="group.friendlyName"
:txt="txt"
:actionlabel="tab.action === 'leavegroup' ? txt.leave : txt.join"
:actionicon="tab.action === 'leavegroup' ? 'person_off' : 'person'"
:actiontype="tab.action === 'leavegroup' ? 'btn-danger' : 'btn-success'"></slot>
</template>
<button
v-if="config.members"
class="btn btn-grouper btn-block btn-primary btn-sm m-1 text-nowrap members-btn"
@click="showSubscribers(group)"
:data-id="encodeURIComponent(group.name)"
:data-name="group.friendlyName">{{ txt.members }}<em class="material-icons mt-0" aria-hidden="true">group</em>
</button>
<a v-if="grouper && owner" :href="grouper + group.uuid" class="btn btn-grouper btn-block btn-sm btn-success mt-0 text-nowrap" target="_blank" role="button">
{{ txt.grouper }} &nbsp;
<em class="material-icons mt-0" aria-hidden="true">link</em>
</a>
</span>
</td>
</tr>
</template>
</collapse>
</tbody>
<tbody v-if="groups?.working?.length">
<collapse :default="config.collapsed" v-slot="{toggle, show}">
<tr class="table-secondary">
<td :colspan="numColumns">
<button type="button"
@click="toggle"
class="btn btn-link btn-text collapse-btn fw-bold m-0 work-group-heading-btn"
role="button"
:aria-expanded="!show ? 'false' : 'true'">
{{ config.wgHeading || 'Working groups' }}
<em class="material-icons mt-0" aria-hidden="true">{{ !show ? 'arrow_right' : 'arrow_drop_down'}}</em>
</button>
</td>
</tr>
<tr v-if="!groups?.working?.length" :class="collapsed ? 'collapse' : 'show'" class="table-light collapse-wg-working-group-parent">
<td :colspan="numColumns" class="text-center">None</td>
</tr>
<template v-for="wggroup in groups?.working" v-if="show">
<collapse :default="config.collapsed" v-slot="{toggle, show}">
<tr class="table-light collapse-wg-working-group-parent">
<td :colspan="numColumns - 2">
<button @click="toggle" type="button" class="btn btn-link btn-text collapse-btn fw-bold m-0" role="button" :aria-expanded="show ? 'false' : 'true'">
<span class="grpr-popover-toggle">
{{ wggroup.WGShowName || "No Name" }}
<em class="material-icons mt-0" aria-hidden="true">{{ show ? 'arrow_drop_down' : 'arrow_right' }}</em>
</span>
</button>
</td>
<td colspan="2">
{{ wggroup.workingDesc || '' }}
</td>
</tr>
<template v-for="(group, key) in wggroup.Groups" v-if="show">
<tr :class="['collapse-wg-' + wggroup.WGName]" class="collapse-wg-working-group" :id="'collapse-wg-' + wggroup.WGName + '-' + key">
<td class="pl-3">
<span class="grpr-popover-toggle" v-popover="group.name">
{{ group.WGApp || "No Name" }}
</span>
</td>
<td v-if="owner">{{ group.WGRole || txt.descrZeroState }}</td>
<td v-if="group.WGApp.match('@lists')">{{ txt.email }}</td>
<td v-else>{{ group.description || txt.descrZeroState }}</td>
</tr>
</template>
</collapse>
</template>
</collapse>
</tbody>
</table>*/
8 changes: 4 additions & 4 deletions webroot/js/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ export default {
});
if (resp.ok) {
this.loadGroups(this.apiPath, this.query, false);
generateFlash(`${this.txt.leaveSuccess} ${group.displayName}`, 'success');
generateFlash(`${this.txt.leaveSuccess} ${group.friendlyName}`, 'success');
} else {
this.error = resp;
generateFlash(`${this.txt.leaveError} ${group.displayName}`, 'error');
generateFlash(`${this.txt.leaveError} ${group.friendlyName}`, 'error');
}
},
async joinGroup(group) {
Expand All @@ -83,10 +83,10 @@ export default {
});
if (resp.ok) {
this.loadGroups(this.apiPath, this.query, false);
generateFlash(`${this.txt.joinSuccess} ${group.displayName}`, 'success');
generateFlash(`${this.txt.joinSuccess} ${group.friendlyName}`, 'success');
} else {
this.error = resp;
generateFlash(`${this.txt.joinError} ${group.displayName}`, 'error');
generateFlash(`${this.txt.joinError} ${group.friendlyName}`, 'error');
}
}
},
Expand Down
10 changes: 5 additions & 5 deletions webroot/js/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export default {
this.loading = false;

},
async removeSubscriber({name}, {id, label}) {
async removeSubscriber({name, friendlyName}, {id, label}) {
this.loading = true;
const resp = await fetch(`${this.api.remove}?group=${encodeURIComponent(name)}&userId=${id}`, {
const resp = await fetch(`${this.api.remove}?group=${(name)}&userId=${id}`, {
method: "DELETE",
headers: {
"Accept": "application/json",
Expand All @@ -91,7 +91,7 @@ export default {
if (resp.ok) {
this.subscribers = [];
this.loadGroupSubscribers(this.group);
generateFlash(`${label} ${this.txt.removeSubscriberSuccess} ${encodeURIComponent(name)}`, 'success');
generateFlash(`${label} ${this.txt.removeSubscriberSuccess} ${(friendlyName)}`, 'success');
} else {
this.disabled = [ ...this.disabled, id ];
generateFlash(this.txt.removeSubscriberError, 'error');
Expand All @@ -101,7 +101,7 @@ export default {
},
async addSubscriber({ identifier: id, label }) {
this.loading = true;
const { name } = this.group;
const { friendlyName, name } = this.group;
const formData = new FormData();
formData.append("userId", id);
formData.append("group", name);
Expand All @@ -115,7 +115,7 @@ export default {
});
if (resp.ok) {
this.loadGroupSubscribers(this.group);
generateFlash(`${label} ${this.txt.addSubscriberSuccess} ${encodeURIComponent(name)}`, 'success');
generateFlash(`${label} ${this.txt.addSubscriberSuccess} ${(friendlyName)}`, 'success');
} else {
generateFlash(this.txt.addSubscriberError, 'error');
}
Expand Down
2 changes: 1 addition & 1 deletion webroot/js/page/GroupMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
<nested-table
:nested="Groups"
:groups="paginated.records"
:columns="['name', 'role', 'description']"
:columns="['name', 'role', 'description'].filter(c => c === 'role' ? owner ? true : false : true)"
:members="true"
@leave-group="searchResult.leave"
@show-subscribers="showSubscribers"></nested-table>
Expand Down

0 comments on commit c881b29

Please sign in to comment.