N°6251 - 1:n - Actions must not be proposed to user not allowed (#491)

This commit is contained in:
bdalsass
2023-05-05 14:28:37 +02:00
committed by GitHub
parent d10e2ac25a
commit b9cfb62d1a
5 changed files with 178 additions and 107 deletions

View File

@@ -60,7 +60,8 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
}
// Add creation in modal if the linkset is not readonly
if (!$this->oAttDef->GetReadOnly()) {
if (!$this->oAttDef->GetReadOnly()
&& $this->bIsAllowCreate) {
$aExtraParams['creation_in_modal'] = true;
$aExtraParams['creation_in_modal_tooltip'] = $this->GetDictionaryEntry(static::BUTTON_TOOLTIP);
$aExtraParams['creation_in_modal_js_handler'] = "{$this->GetWidgetName()}.links_view_table('CreateLinkedObject');";
@@ -76,30 +77,34 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
{
$aRowActions = array();
$aRowActions[] = array(
'label' => 'UI:Links:ModifyLink:Button',
'name' => 'ModifyButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_BUTTON_TOOLTIP),
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['Link/_key_/raw'], oTrElement, aRowData['Remote/friendlyname']);",
'metadata' => [
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_MODAL_TITLE),
],
);
if ($this->bIsAllowModify) {
$aRowActions[] = array(
'label' => 'UI:Links:ModifyLink:Button',
'name' => 'ModifyButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_BUTTON_TOOLTIP),
'icon_classes' => 'fas fa-pen',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('ModifyLinkedObject', aRowData['Link/_key_/raw'], oTrElement, aRowData['Remote/friendlyname']);",
'metadata' => [
'modal-title' => $this->GetDictionaryEntry(static::DICT_MODIFY_LINK_MODAL_TITLE),
],
);
}
$aRowActions[] = array(
'label' => 'UI:Links:Remove:Button',
'name' => 'RemoveButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP),
'icon_classes' => 'fas fa-minus',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['Link/_key_/raw'], oTrElement);",
'confirmation' => [
'title' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_TITLE),
'message' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_MESSAGE),
'row_data' => "Remote/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
if ($this->bIsAllowDelete) {
$aRowActions[] = array(
'label' => 'UI:Links:Remove:Button',
'name' => 'RemoveButton',
'tooltip' => $this->GetDictionaryEntry(static::DICT_REMOVE_BUTTON_TOOLTIP),
'icon_classes' => 'fas fa-minus',
'js_row_action' => "{$this->GetWidgetName()}.links_view_table('DeleteLinkedObject', aRowData['Link/_key_/raw'], oTrElement);",
'confirmation' => [
'title' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_TITLE),
'message' => $this->GetDictionaryEntry(static::DICT_REMOVE_MODAL_MESSAGE),
'row_data' => "Remote/hyperlink",
'do_not_show_again_pref_key' => $this->GetDoNotShowAgainPreferenceKey(),
],
);
}
return $aRowActions;
}