public static function whereClause($type,
&$tables,
&$whereTables,
- $contactID = NULL,
- $onlyDeleted = FALSE,
+ $contactID = NULL,
+ $onlyDeleted = FALSE,
$skipDeleteClause = FALSE
) {
// the default value which is valid for rhe final AND
*/
public static function group(
$type,
- $contactID = NULL,
- $tableName = 'civicrm_saved_search',
- $allGroups = NULL,
+ $contactID = NULL,
+ $tableName = 'civicrm_saved_search',
+ $allGroups = NULL,
$includedGroups = NULL
) {
if ($contactID == NULL) {
public static function groupPermission(
$type,
$groupID,
- $contactID = NULL,
- $tableName = 'civicrm_saved_search',
- $allGroups = NULL,
+ $contactID = NULL,
+ $tableName = 'civicrm_saved_search',
+ $allGroups = NULL,
$includedGroups = NULL,
$flush = FALSE
) {
/* Include clause if we're looking for a specific table/id permission */
-
if (!empty($object_table)) {
$where .= " AND ( {$t['ACL']}.object_table IS null
OR ({$t['ACL']}.object_table = '" . CRM_Utils_Type::escape($object_table, 'String') . "'";
/* Include clause if we're granting an ACL or ACL Role */
-
if (!empty($acl_id)) {
$where .= " AND ({$t['ACL']}.acl_id IS null
OR {$t['ACL']}.acl_id = " . CRM_Utils_Type::escape($acl_id, 'Integer') . ')';
/* Query for permissions granted to all contacts in the domain */
-
$query[] = "SELECT {$t['ACL']}.*, 0 as override
FROM {$t['ACL']}
/* Query for permissions granted to all contacts through an ACL group */
-
$query[] = "SELECT {$t['ACL']}.*, 0 as override
FROM {$t['ACL']}
/* Query for permissions granted directly to the contact */
-
$query[] = "SELECT {$t['ACL']}.*, 1 as override
FROM {$t['ACL']}
/* Query for permissions granted to the contact through an ACL group */
-
$query[] = "SELECT {$t['ACL']}.*, 1 as override
FROM {$t['ACL']}
/* Query for permissions granted to the contact through a group */
-
$query[] = "SELECT {$t['ACL']}.*, 0 as override
FROM {$t['ACL']}
AND {$t['GroupContact']}.contact_id = $contact_id
AND {$t['GroupContact']}.status = 'Added')";
-
/* Query for permissions granted through an ACL group to a Contact
* group */
-
$query[] = "SELECT {$t['ACL']}.*, 0 as override
FROM {$t['ACL']}
* 3) the rule governs the specific object we want
*/
-
if (empty($dao->object_table) ||
($dao->object_table == $object_table
&& (empty($dao->object_id)
else {
/* Otherwise try to generate a clause for this rule */
-
$clause = self::getClause(
$dao->object_table, $dao->object_id, $tables
);
* (id is null) on a table other than the one we're interested
* in. So skip it. */
-
if (empty($clause)) {
continue;
}
/* Now we figure out if this is an allow or deny rule, and possibly
* a contact-level override */
-
if ($dao->deny) {
$deny[] = $clause;
}
*
* @return array - Assoc. array of the ACL rule's properties
*/
- public function toArray($format = '%s', $hideEmpty = false) {
+ public function toArray($format = '%s', $hideEmpty = FALSE) {
$result = array();
if (!self::$_fieldKeys) {
$rule = new CRM_ACL_BAO_ACL();
-
$acl = self::getTableName();
$contact = CRM_Contact_BAO_Contact::getTableName();
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
$rule = new CRM_ACL_BAO_ACL();
-
$acl = self::getTableName();
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
$group = CRM_Contact_BAO_Group::getTableName();
$acl = self::getTableName();
$aclRole = 'civicrm_acl_role';
-
$aclER = CRM_ACL_DAO_EntityRole::getTableName();
$c2g = CRM_Contact_BAO_GroupContact::getTableName();
$group = CRM_Contact_BAO_Group::getTableName();
return FALSE;
}
-
$query = "
SELECT count( a.id )
FROM civicrm_acl_cache c, civicrm_acl a
* @return array
*/
public static function group($type,
- $contactID = NULL,
- $tableName = 'civicrm_saved_search',
- $allGroups = NULL,
+ $contactID = NULL,
+ $tableName = 'civicrm_saved_search',
+ $allGroups = NULL,
$includedGroups = NULL
) {
' ', TRUE
);
-
$label = ts('Role');
$role = array(
'-1' => ts('- select role -'),
// note this also resets any ACL cache
CRM_Core_BAO_Cache::deleteGroup('contact fields');
-
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_ACL_BAO_ACL::del($this->_id);
CRM_Core_Session::setStatus(ts('Selected ACL has been deleted.'), ts('Record Deleted'), 'success');
array('</td><td>', '</td></tr><tr><td>')
);
-
$label = ts('Role');
- $role = array('-1' => ts('- select role -'),
+ $role = array(
+ '-1' => ts('- select role -'),
'0' => ts('Everyone'),
) + CRM_Core_OptionGroup::values('acl_role');
$entityID = &$this->add('select', 'entity_id', $label, $role, TRUE);
$aclRoles, TRUE
);
-
-
$label = ts('Assigned to');
$group = array('' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup(FALSE, 'Access');
$this->add('select', 'entity_id', $label, $group, TRUE, array('class' => 'crm-select2 huge'));
*
* @return void
*/
- public function buildQuickForm( ) {
+ public function buildQuickForm() {
CRM_Utils_System::setTitle( 'Wordpress Access Control' );
$roleObj = $wp_roles->get_role($role);
if (!empty($roleObj->capabilities)) {
foreach ($roleObj->capabilities as $ckey => $cname) {
- if (array_key_exists($ckey , $permissionsArray)) {
+ if (array_key_exists($ckey, $permissionsArray)) {
$elementName = $role.'['.$ckey.']';
$defaults[$elementName] = 1;
}
$rolePerms[$role] = $permissionsArray;
foreach ( $rolePerms[$role] as $key => $value) {
$elementName = $role.'['.$key.']';
- $this->add('checkbox' , $elementName , $value);
+ $this->add('checkbox', $elementName, $value);
}
$roles[$role] = $name;
}
$this->addButtons(
array(
- array (
+ array(
'type' => 'next',
'name' => ts('Save'),
'spacing' => '',
- 'isDefault' => false ),
+ 'isDefault' => FALSE ),
)
);
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) {
+ foreach ($allWarningPermissions as $key => $permission) {
$allWarningPermissions[$key] = CRM_utils_String::munge(strtolower($permission));
}
$warningPermissions = array_intersect($allWarningPermissions, array_keys($rolePermissions));
);
// set breadcrumb to append to admin/access
- $breadCrumb = array(array('title' => ts('Access Control'),
+ $breadCrumb = array(array(
+ 'title' => ts('Access Control'),
'url' => CRM_Utils_System::url('civicrm/admin/access',
'reset=1'
),
$roles = CRM_Core_OptionGroup::values('acl_role');
- $group = array('-1' => ts('- select -'),
+ $group = array(
+ '-1' => ts('- select -'),
'0' => ts('All Groups'),
) + CRM_Core_PseudoConstant::group();
- $customGroup = array('-1' => ts('- select -'),
+ $customGroup = array(
+ '-1' => ts('- select -'),
'0' => ts('All Custom Groups'),
) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_CustomField', 'custom_group_id');
- $ufGroup = array('-1' => ts('- select -'),
+ $ufGroup = array(
+ '-1' => ts('- select -'),
'0' => ts('All Profiles'),
) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
- $event = array('-1' => ts('- select -'),
+ $event = array(
+ '-1' => ts('- select -'),
'0' => ts('All Events'),
) + CRM_Event_PseudoConstant::event();
$acl[$dao->id]['object_id'] = $dao->object_id;
$acl[$dao->id]['is_active'] = $dao->is_active;
-
if ($acl[$dao->id]['entity_id']) {
$acl[$dao->id]['entity'] = $roles[$acl[$dao->id]['entity_id']];
}
);
// set breadcrumb to append to admin/access
- $breadCrumb = array(array('title' => ts('Access Control'),
+ $breadCrumb = array(array(
+ 'title' => ts('Access Control'),
'url' => CRM_Utils_System::url('civicrm/admin/access', 'reset=1'),
));
CRM_Utils_System::appendBreadCrumb($breadCrumb);
);
// set breadcrumb to append to admin/access
- $breadCrumb = array(array('title' => ts('Access Control'),
+ $breadCrumb = array(array(
+ 'title' => ts('Access Control'),
'url' => CRM_Utils_System::url('civicrm/admin/access',
'reset=1'
),