/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form {
/**
- * Function to build the form
+ * Build the form object
*
* @access public
* @return void
}
/**
- * Function to process the form
+ * Process the form submission
*
* @access public
* @return void
$roleObj->add_cap($key);
}
}
+
+ if ($role == 'anonymous_user') {
+ // Get the permissions into a format that matches what we get from WP
+ $allWarningPermissions = CRM_Core_Permission::getAnonymousPermissionsWarnings();
+ foreach ($allWarningPermissions as $key => $permission) {
+ $allWarningPermissions[$key] = CRM_utils_String::munge(strtolower($permission));
+ }
+ $warningPermissions = array_intersect($allWarningPermissions, array_keys($rolePermissions));
+ $warningPermissionNames = array();
+ foreach ($warningPermissions as $permission) {
+ $warningPermissionNames[$permission] = $permissionsArray[$permission];
+ }
+ if (!empty($warningPermissionNames)) {
+ CRM_Core_Session::setStatus(
+ ts('The %1 role was assigned one or more permissions that may prove dangerous for users of that role to have. Please reconsider assigning %2 to them.', array( 1 => $wp_roles->role_names[$role], 2 => implode(', ', $warningPermissionNames))),
+ ts('Unsafe Permission Settings')
+ );
+ }
+ }
}
// FIXME
return $perms_array;
}
}
-