1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Only show CRUDS actions if you have proper permissions.

This commit is contained in:
Thomas Tanghus 2012-08-30 23:01:38 +02:00
parent 5905e6c314
commit b454e6a3d3
2 changed files with 15 additions and 1 deletions

View File

@ -62,6 +62,9 @@ class OC_Contacts_Addressbook {
$addressbooks = array();
while( $row = $result->fetchRow()) {
$row['permissions'] = OCP\Share::PERMISSION_CREATE
| OCP\Share::PERMISSION_READ | OCP\Share::PERMISSION_UPDATE
| OCP\Share::PERMISSION_DELETE | OCP\Share::PERMISSION_SHARE;
$addressbooks[] = $row;
}
$addressbooks = array_merge($addressbooks, OCP\Share::getItemsSharedWith('addressbook', OC_Share_Backend_Addressbook::FORMAT_ADDRESSBOOKS));

View File

@ -12,7 +12,9 @@
<?php foreach($_['addressbooks'] as $addressbook) { ?>
<tr class="addressbook" data-id="<?php echo $addressbook['id'] ?>" data-uri="<?php echo $addressbook['uri'] ?>">
<td class="active">
<?php if($addressbook['permissions'] & OCP\Share::PERMISSION_UPDATE) { ?>
<input type="checkbox" <?php echo (($addressbook['active']) == '1' ? ' checked="checked"' : ''); ?> />
<?php } ?>
</td>
<td class="name"><?php echo $addressbook['displayname'] ?></td>
<td class="description"><?php echo $addressbook['description'] ?></td>
@ -23,17 +25,26 @@
<a class="svg action cloud" title="<?php echo $l->t('Show read-only VCF link'); ?>"></a>
</td>
<td class="action">
<a class="svg action share" data-item-type="addressbook" data-item="<?php echo $addressbook['id'] ?>" title="<?php echo $l->t("Share"); ?>"></a>
<?php if($addressbook['permissions'] & OCP\Share::PERMISSION_SHARE) { ?>
<a class="svg action share" data-item-type="addressbook"
data-item="<?php echo $addressbook['id'] ?>"
data-possible-permissions="<?php echo $addressbook['permissions'] ?>"
title="<?php echo $l->t("Share"); ?>"></a>
<?php } ?>
</td>
<td class="action">
<a class="svg action download" title="<?php echo $l->t('Download'); ?>"
href="<?php echo OCP\Util::linkToAbsolute('contacts', 'export.php'); ?>?bookid=<?php echo $addressbook['id'] ?>"></a>
</td>
<td class="action">
<?php if($addressbook['permissions'] & OCP\Share::PERMISSION_UPDATE) { ?>
<a class="svg action edit" title="<?php echo $l->t("Edit"); ?>"></a>
<?php } ?>
</td>
<td class="action">
<?php if($addressbook['permissions'] & OCP\Share::PERMISSION_DELETE) { ?>
<a class="svg action delete" title="<?php echo $l->t("Delete"); ?>"></a>
<?php } ?>
</td>
</tr>
<?php } ?>