Commit a8a4636e authored by Christian Wach's avatar Christian Wach

Sanity check role before adding caps

parent 5d797086
...@@ -257,6 +257,11 @@ class CiviCRM_Permissions_Sync { ...@@ -257,6 +257,11 @@ class CiviCRM_Permissions_Sync {
// Get the role to apply all CiviCRM permissions to. // Get the role to apply all CiviCRM permissions to.
$custom_role = $this->role_get(); $custom_role = $this->role_get();
// Bail if something went wrong.
if ( empty( $custom_role ) ) {
return;
}
// Add the capabilities if not already added. // Add the capabilities if not already added.
foreach( $capabilities as $capability ) { foreach( $capabilities as $capability ) {
if ( ! $custom_role->has_cap( $capability ) ) { if ( ! $custom_role->has_cap( $capability ) ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment