Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCHR-3376: Update T&A Administer Menu Items #325

Merged

Conversation

mickadoo
Copy link
Contributor

Overview

We are changing what menu items can be accessed. T&A provides some items for the "Configure" submenu, and these will be altered.

Before

image

  • T&A provided the "Tasks" submenu in the "Configure" menu but no items had permission set
  • It cloned two items from the CiviCase submenu, which were relabled as "Workflows" and "Workflows Status"
  • The weight of the "Tasks" item was not set and so it appears at the top of the list

After

image

  • The permission for all T&A menu items is administer CiviCase.
  • The "Workflows Status" menu item is no longer cloned.
  • The weight of "Tasks" has been set so it appears in the required order (before "Leave")

$params = ['return' => 'id', 'name' => 'tasksassignments_administer'];
$parentId = (int) civicrm_api3('Navigation', 'getvalue', $params);
$params = ['return' => 'id', 'name' => 'ta_settings'];
$taSettingsId = (int) civicrm_api3('Navigation', 'getvalue', $params);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we just call the Navigation API once to get the ids of the menu's rather than twice?

}

// Update parent weight
civicrm_api3('Navigation', 'create', ['id' => $parentId, 'weight' => -97]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can actually update permission and weight of the parentID in one call and the permission of taSettingsId in another call, which means we will call the API two times rather than three.
We can have a function do this that will optionally update the permission or not if present

@mickadoo mickadoo merged commit 2fa84ea into PCHR-3162-configurability-changes Mar 13, 2018
@mickadoo mickadoo deleted the PCHR-3376-update-permissions branch March 13, 2018 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants