diff --git a/CRM/Groupprotect/BAO/GroupProtect.php b/CRM/Groupprotect/BAO/GroupProtect.php
index 4ef93a5..0be0306 100755
--- a/CRM/Groupprotect/BAO/GroupProtect.php
+++ b/CRM/Groupprotect/BAO/GroupProtect.php
@@ -33,10 +33,23 @@ public static function buildForm($formName, $form) {
*/
public static function pre($op, $objectName, $objectId, $params) {
if ($objectName == 'GroupContact' && self::groupIsProtected($objectId) == TRUE) {
- if (!CRM_Core_Permission::check('manage protected groups')) {
- CRM_Core_Session::setStatus(ts("You are not allowed to add or remove contacts to this group"), ts("Not allowed"), "error");
- $session = CRM_Core_Session::singleton();
- CRM_Utils_System::redirect($session->readUserContext());
+ // check if request is from webform, and allow groupcontact action if from webform
+ $webFormRequest = FALSE;
+ $request = CRM_Utils_Request::exportValues();
+ if (isset($request['form_id'])) {
+ $requestParts = explode('_', $request['form_id']);
+ if (isset($requestParts[2])) {
+ if ($requestParts[0] == 'webform' && $requestParts[1] == 'client' && $requestParts[2] = 'form') {
+ $webFormRequest = TRUE;
+ }
+ }
+ }
+ if (!$webFormRequest) {
+ if (!CRM_Core_Permission::check('manage protected groups')) {
+ CRM_Core_Session::setStatus(ts("You are not allowed to add or remove contacts to this group"), ts("Not allowed"), "error");
+ $session = CRM_Core_Session::singleton();
+ CRM_Utils_System::redirect($session->readUserContext());
+ }
}
}
}
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
index 139a360..aee1e0e
--- a/README.md
+++ b/README.md
@@ -5,3 +5,5 @@ This extension adds a custom data set to groups and adds a permission (CiviCRM G
The custom group adds a field for the Group: protected Yes or No. This settings can only be edited by users with the permission CiviCRM Group Protect.
Only users with the permission CiviCRM Group Protect can add or remove contacts from a protected group.
+
+The check on if a group is allowed is skipped if the request originates from a Drupal Webform
diff --git a/info.xml b/info.xml
index fe47a12..73513aa 100755
--- a/info.xml
+++ b/info.xml
@@ -15,7 +15,7 @@
http://www.gnu.org/licenses/agpl-3.0.html
2016-01-12
- 0.3
+ 1.0
beta
4.4