Skip to content
Snippets Groups Projects
Commit 450d968f authored by Kevin Cristiano's avatar Kevin Cristiano :earth_americas:
Browse files

4.7.0 release

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 2361 additions and 0 deletions
CiviCRM (WordPress Integration)
===============================
This is the development repository for the *CiviCRM* plugin for *WordPress*. What you see here is not intended as the code for the installation of *CiviCRM* in *WordPress* - if you want to do that, please visit:
[https://civicrm.org/download](https://civicrm.org/download)
### Contribute ###
If you want to contribute to the development of this plugin, please bear the following in mind:
* Bug fixes should go in the branch 4.5 branch (stable)* Structural changes should go under master (trunk, i.e. 4.6).
----
### About CiviCRM ###
CiviCRM is web-based, open source, Constituent Relationship Management (CRM) software geared toward meeting the needs of non-profit and other civic-sector organizations.
As a non profit committed to the public good itself, CiviCRM understands that forging and growing strong relationships with constituents is about more than collecting and tracking constituent data - it is about sustaining relationships with supporters over time.
To this end, CiviCRM has created a robust web-based, open source, highly customizable, CRM to meet organizations’ highest expectations right out-of-the box. Each new release of this open source software reflects the very real needs of its users as enhancements are continually given back to the community.
With CiviCRM's robust feature set, organizations can further their mission through contact management, fundraising, event management, member management, mass e-mail marketing, peer-to-peer campaigns, case management, and much more.
CiviCRM is localized in over 20 languages including: Chinese (Taiwan, China), Dutch, English (Australia, Canada, U.S., UK), French (France, Canada), German, Italian, Japanese, Russian, and Swedish.
For more information, visit the [CiviCRM website](https://civicrm.org).
\ No newline at end of file
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*
*/
?>
<div class="crm-container crm-public<?php echo $class; ?>">
<?php if ( $show_title ) { ?>
<h2><?php echo $title; ?></h2>
<?php } ?>
<?php if ( $description ) { ?>
<div class="civi-description"><?php echo $description; ?></div>
<?php } ?>
<p><?php echo $more_link; ?></p>
<?php if ( $empowered_enabled ) { ?>
<div class="crm-public-footer">
<?php echo $footer; ?>
</div>
<?php } ?>
</div>
This diff is collapsed.
The following people and organizations sponsored and/or contributed new and improved features to the project.
************************************************
Key Contributors and Sponsors for 4.7
************************************************
CiviCRM Team - Atif Shaikh, Coleman Watts, David Greenberg, Eileen McNaughton,
Jitendra Purohit, Josh Gowan, Kurund Jalmi,
Michael McAndrew, Monish Deb, Rohan Ramesh Katkar, Tim Otten,
Yashodha Chaku
AGH Strategies - Andrew Hunt, Tyrell Cook, Nikki Murray
Agileware - Francis Whittle
Andrew West
Aputsiaĸ Niels Janussen
Aron Novak
Backoffice Thinking
Barbara Miller
Borislav Zlatanov
Brian Dombrowski
Caroline Badley
Christian Wach
Charlie DeTar
Circle Interactive - Dave Jenkins
CiviCoop - Jaap Jansma
CiviDesk - Nicolas Ganivet, Sunil Pawar, Virginie Ganivet
Compucorp - Guanhuan Chen, Jamie Novick
CiviCoop - Jaap Jansma
Coop SymbioTIC - Mathieu Lutfy, Samuel Vanhove
Dave D
David Hayes
Dhanesh Dhuri
Dmitry Smirnov
Elin Waring
Emphanos LLC - Allen Shaw
Esantanche
Freeform Solutions - Lola Slade, Stephanie Gray
Future First - David Knoll, John Prescott
Fuzion NZ - Chris Burgess, Eileen McNaughton, Peter Davis, Torrance Hodgeson
Giant Rabbit - Peter Haight
Ginkgo Street Labs - Frank Gomez, Galata Tona, Michael Daryabeygi, Roshani Kothari, Toby Lounsbury
Herb
Jake Martin White
Joanne Chester
Joe McLaughlin
Johan Vervloet
John P Kirk
Joris
JMA Consulting - Joe Murray, Pradeep Nayak, Edsel Lopez
gah242s
Greenleaf Advancement - Guy Iaccarino
K Sneed Consulting - Kate Sneed
Kemal Bay
Ken West
Kevin Levie
Korlon - Stuart Gaston
kreynen
Laryn
Lesley Evensen (zorgalina)
Lighthouse Consulting and Design - Brian Shaughnessy
Marty Wright
Matthew Wire
Mattias Michaux
Mohit Aggarwal
National Urban League - Lisa Taliano
Nicholai Burton
Niels Heinemann
New York City Council
New York State Senate - Ken Zalewski
Northbridge Digital - Oliver Gibson
Olaf Buddenhagen
Palante Technology Cooperative - Jon Goldberg, Joseph Lacey, Paul Campbell
Progressive Tech Project - Alice Aguilar, Jamie McClelland
Richard Van Oosterhout
RocXa
Saurabh Batra
Seamus Lee
Seb35
Semper IT - Karin Gerritsen
Shawn Holt
Skvare - Jeremy Proffitt, Peter Petrik
Smiling Heart Enterprises - Neil Planchon
Squiffle Consulting - Aidan Saunders
Stephen Palmstrom
Symbiotic - Mathieu Lutfy, Samuel Vanhove
Systopia - Björn Endres, Niko Bochan
Tadpole - Dana Skallman, Kevin Cristiano
Tech to the People - Xavier Dutoit
Thomas Leichtuss
Tim Mallezie
Torenware Networks - Rob Thorne
University of Cambridge – Alex Corr, John Kingsnorth
Veda Consulting - Parvez Saleh, Deepak Srivastava, Kajan
Wanna Pixel - Nathan Porter, Marisa Porter
Web Access - Sudha Bisht
Wikimedia Foundation - Adam Wight
yurg
zarandras
************************************************
Key Contributors and Sponsors for 4.6
************************************************
CiviCRM Team - Atif Shaikh, Coleman Watts, David Greenberg, Donald Lobo,
Eileen McNaughton, Jitendra Purohit, Josh Gowan, Kurund Jalmi,
Michael McAndrew, Monish Deb, Rohan Ramesh Katkar, Tim Otten,
Yashodha Chaku
ADG Communications - Steve Binkowski
AGH Strategies - Andrew Hunt, Jane Hanley, Tommy Bobo, Tyrell Cook
Alex C
Allan Chappell
Amnesty International Spain - Carlos Capote
Andreas Hennings
Andy Clark
Arete Imagine - Marisa Porter, Nate Porter
Asylum Hill Congregational Church
Blackfly Solutions - Alan Dixon
Botanical Society of America - Toby Lounsbury
Christian Wach
Chris Ward
Circle Interactive - Dave Moreton, Andrew Walker, Dave Jenkins, Maya Gibbs
CiviCoop - Erik Hommel, Jaap Jansma
CiviDesk - Nicolas Ganivet, Sunil Pawar
Community Human Services Corporation - Paul Mosey
Compucorp - Jamie Novick, Greg Meszeros, Robin Mitra, Guanhuan Chen, Chanun Chirattikanon
David Hepper
Detlev Sieber
Drishtant - Ruchi Kumar
Drupal Association - Neil Drumm
Elliott Eggleston
Freeform Solutions - Lola Slade
Future First - David Knoll, John Prescott, Vitor Nobrega
Fuzion, NZ - Chris Burgess, Eileen McNaughton, Peter Davis
Giantrabbit - Anthony Nemirovsky, Peter Haight
Ginkgo Street Labs - Frank J. Gómez, Michael Daryabeygi
GMVCO Databases - Jon-man Cheung, Alex Lee, Craig Almond
Google Summer of Code - Aditya Nambiar, Siddhant Rajagopalan, Torrance Hodgeson
Gnu.org - David Thompson
Jaka Kranjc
JMA Consulting - Joe Murray, Pradeep Nayak, Edsel Lopez
Joanne Chester
Johan Vervloet
John Kingsnorth
jsnyder83
Kathryn Benedicto
Han Velthuis
Ken West
Kirk Jackson
Korlon - Stuart Gaston
Lighthouse Consulting and Design - Brian Shaughnessy
Mattias Michaux
Max
MC3 - Graham Mitchell
Mission Matters - Joshua Aranda
Mobius - Jeremy Proffitt
Northbridge Digital - Oliver Gibson
Symbiotic - Mathieu Lutfy, Samuel Vanhove
National Democratic Institute - Chris Doten
New York State Senate - Ken Zalewski
Niro Solutions
Palente Technology Cooperative - Jon Goldberg, Joseph Lacey
Paul Campbell
Pogstone - Sarah Gladstone
Progressive Tech Project - Alice Aguilar, Jamie McClelland
Registered Nurses Association of Ontario - Stan Dragnev
Richard Van Oosterhout
Seamus Lee
Semper IT - Karin Gerritsen
Skvare - Mark Hanna, Peter Petrik
Squiffle Consulting - Aidan Saunders
Stephen Palmstrom
Systopia - Björn Endres, Fabian Schuttenberg, Martin Peth, Niko Bochan
Tadpole - Dana Skallman, Kevin Cristiano
Tech to the People - Xavier Dutoit
TeNNoX
Tim Mallezie
Toke Høiland-Jørgensen
Veda Consulting - Priyanka Karan, Parvez Saleh, Deepak Srivastava
William Theaker
Web Access - Tony Mazzerella, Nileema Jadhav, Parag Bhilkar, Pratiksha Dubey, Manish More
Wikimedia Foundation - Adam Wight
Zing - Simon West, Andrew Tombs, Vivek Arora
************************************************
Key Contributors and Sponsors for 4.5
************************************************
CiviCRM Team - Coleman Watts, David Greenberg, Donald Lobo,
Kurund Jalmi, Michael McAndrew, Monish Deb, Pratik Joshi,
Tim Otten, Yashodha Chaku, Eileen McNaughton
AGH Strategies - Andrew Hunt, Maggie Epps, Tyrell Cook
Allan Chappell
Amnesty International Spain - Carlos Capote
Andy Clark
Arete Imagine - Marisa Porter, Nate Porter
Botanical Society of America - Toby Lounsbury
Chris Burgess
Chris Ward
Circle Interactive - Andrew Walker, Dave Jenkins
CiviDesk - Nicolas Ganivet, Sunil Pawar
Compucorp - Jamie Novick, Erawat Chamanont
CiviCoop - Erik Hommel, Jaap Jansma
Detlev Sieber
Drishtant - Ruchi Kumar
Drupal Association - Neil Drumm
Electronic Frontier Foundation - Mark Burdett, Max Hunter, Leez Wright
Freeform Solutions - Lola Slade
Fuzion, NZ - Eileen McNaughton, Peter Davis, Torrance Hodgeson
Giant Rabbit - Peter Haight, Anthony Nemirovsky
Ginkgo Street Labs - Frank J. Gómez, Michael Daryabeygi
Graham Mitchell
Great Lakes Planetarium Association - Geoff Holt
Jennifer Simonis
Jeremy Proffitt
Jim Meehan
Jimmy Huang
JMA Consulting - Joe Murray
Joanne Chester
Ken West
Kirk Jackson
Korlon - Stuart Gaston
Koumbit - Samuel Vanhove
Lighthouse Consulting and Design - Brian Shaughnessy
Mathieu Lutfy
Mission Matters - Joshua Aranda
National Democratic Institute - Chris Doten
New York State Senate - Ken Zalewski
Niro Solutions
Palente Technology Cooperative - Jon Goldberg, Joseph Lacey
Pogstone - Sarah Gladstone
Progressive Tech Project - Alice Aguilar, Jamie McClelland
Semper IT - Karin Gerritsen
Skvare - Mark Hanna, Peter Petrik
Systopia - Björn Endres
Tadpole - Dana Skallman
Tech to the People - Xavier Dutoit
Veda Consulting - Parvez Saleh, Deepak Srivastava
Web Access - Pradeep Nayak, Tony Mazzarella
Wikimedia Foundation - Adam Wight
Zing - Simon West, Andrew Tombs
************************************************
Key Contributors and Sponsors for 4.4
************************************************
CiviCRM Team - Coleman Watts, David Greenberg, Donald Lobo,
Kurund Jalmi, Michael McAndrew, Monish Deb,
Tim Otten, Yashodha Chaku, Eileen McNaughton
AGH Strategies - Andrew Hunt
Backoffice Thinking
Chris Burgess
Circle Interactive - Andrew Walker, Dave Jenkins
CiviDesk - Nicolas Ganivet
CiviCoop - Erik Hommel, Jaap Jansma
CiviHosting - Hershel Robinson
CompuCorp - Jamie Novick, Erawat Chamanont
Confluence - Frank Gomez, Michael Daryabeygi
Dave D
Detlev Sieber
Drupal Association - Neil Drumm
Electronic Frontier Foundation - Micah Lee, Kellie Brownell
Emphanos - Allen Shaw
Freeform Solutions - Lola Slade
Fuzion, NZ - Eileen McNaughton, Peter Davis, Torrance Hodgeson
Giant Rabbit - Anna Heath
Jim Meehan
JMA Consulting - Joe Murray
Joanne Chester
Keith Morgan
Ken West
Korlon - Stuart Gaston
Koumbit - Samuel Vanhove
Lighthouse Consulting and Design - Brian Shaughnessy
Mathieu Lutfy
National Democratic Institute - Chris Doten
New York State Senate - Ken Zalewski
NfP Services (MTL Software Group) - Jag Kandasamy, Rajesh Sundararajan
Niro Solutions
Noah Miller
Orgis - Hans Idink
Palente Technology Cooperative - Jon Goldberg, Joseph Lacey
Paul Delbar
Pogstone - Sarah Gladstone
Progressive Tech Project - Alice Aguilar, Jamie McClelland
Registered Nurses Association of Ontario
San Francisco Baykeeper - Eliet Henderson
Tadpole - Dana Skallman
Tallyfox
Tech to the People - Xavier Dutoit
Veda Consulting - Parvez Saleh, Deepak Srivastava
Web Access - Pradeep Nayak
Wikimedia Foundation - Adam Wight
Zing - Simon West, Andrew Tombs
************************************************
Key Contributors and Sponsors for 4.3
************************************************
CiviCRM Team - Coleman Watts, David Greenberg, Deepak Srivastava, Donald Lobo,
Kurund Jalmi, Michael McAndrew, Pratik Joshi, Ravish Nair,
Tim Otten, Yashodha Chaku, Eileen McNaughton
AGH Strategies - Andrew Hunt
Backoffice Thinking
Chris Burgess
Circle Interactive - Andrew Walker, Dave Jenkins
CiviDesk - Nicolas Ganivet
CiviHosting - Hershel Robinson
Community Builders
Compucorp
Dave D
EE-atWork - Erik Hommel
Electronic Frontier Foundation - Micah Lee, Kellie Brownell
Emphanos - Allen Shaw
Fuzion, NZ - Eileen McNaughton, Peter Davis, Torrance Hodgeson
Ginkgo Street Labs - Frank J. Gómez, Michael Daryabeygi
Jim Meehan
JMA Consulting - Joe Murray, Pradeep Nayak
Keith Morgan
Ken West
Korlon - Stuart Gaston
Koumbit - Samuel Vanhove
Lighthouse Consulting and Design - Brian Shaughnessy
Mathieu Lutfy
New York State Senate - Ken Zalewski
NfP Services (MTL Software Group) - Jag Kandasamy, Rajesh Sundararajan
Niro Solutions
Noah Miller
Palente Technology Cooperative - Jon Goldberg
Progressive Tech Project - Alice Aguilar, Jamie McClelland
Paul Delbar
Registered Nurses Association of Ontario
San Francisco Baykeeper - Eliet Henderson
Tech to the People - Xavier Dutoit
Third Sector Design
Veda Consulting - Parvez Saleh
Web Access
Zing - Simon West, Andrew Tombs
************************************************
Sponsors and key contributors for 4.2
************************************************
The following people and organizations sponsored and/or contributed new and improved features for the 4.2 release.
Abril Rocabert
Adam Wight
Alice Aguilar
Allen Shaw
Andres Spagarino
Andrew Hunt
Anthony Camilleri
Ariel Gold
Brian Shaughnessy
Chris Ward
Dave Moreton
Eileen McNaughton
Eliet Henderson
Erik Hommel
Frank Gomez
Graylin Kim
Jamie McClelland
Jane Hanley
Jason Bertolacci
Joe Murray
John Derry
Jon Goldberg
Kasia Wakarecy
Katie Horn
Katy Jockelson
Ken Zalewski
Lisa Jervis
Mathieu Lutfy
Matt Neimayer
Micah Lee
Michael McAndrew
Nicolas Ganivet
Noah Miller
Parvez Saleh
Peter Gehres
Peter McAndrew
Robyn Perry
Samuel Vanhove
Simon West
Stéphane Lussier
Stuart Gaston
Xavier Dutoit
Art of Living
Backoffice Thinking
Community Builders
DC Road Runners
EE atWork
Electronic Frontier Foundation
Freeform Solutions
Free Software Foundation
Fuzion NZ
Gingko Street Consulting
JMA Consulting
Korlon
Koumbit
Lighthouse Consulting
National Democratic Institute
New York State Senate
NS Web Solutions
Progressive Technology Project
San Francisco Baykeeper
Tech to the People
The Monthly.com
Veda Consulting
Xstreme Media
Zing
************************************************
Sponsors and key contributors for 4.1
************************************************
The following people and organizations sponsored and/or contributed new and improved features for the 4.1 release.
Adam Wight
Andrew Harris
Alice Aguilar
Andre Gurgel
Brian Shaugnessy
Coleman Watts
Dave D
Dave Moreton
Eileen McNaughton
Erik Brower
Erik Hommel
Henry Bennett
Jamie McClelland
Jim Taylor
Jonathan Mark
Joe Murray
Marianela Zucotti Bozzano
Michael McAndrew
Steve Colson
Stuart Gaston
Tim Otten
Tom Kirkpatrick
Xavier Dutoit
AGH Strategies
Amigos Library Services
Association for Learning Technology
Attendee Management
Benton Consulting
Circle Interactive
CivicActions
Community Builders
EE-atWork
Fuzion (NZ)
Giant Rabbit
Kindling Trust
Korlon
International Mountain Biking Association
International Society for Bayesian Analysis
Josiesque Designs
Michigan Parents for Schools
New York State Senate
Nonprofit Association of Oregon
Nonprofit Solutions
Powered by Action
Progressive Technology Project
Resolutions Northwest
River Pool at Beacon
Rooty Hollow
San Francisco Baykeeper
Scotland's Colleges
Switchback
System Seed
Tech to the People
The San Francisco Orff-Schulwerk
Third Sector Design
Voluntary Action Westminster
Vpod Schweiz
Woven
************************************************
Sponsors for 3.4 / 4.0 Make-it-Happen Projects
************************************************
The following people and organizations sponsored new and improved features for the 3.4 / 4.0 release.
ACORN Canada http://acorncanada.org
Allora Consulting http://alloraconsulting.com
American Friends Service Committee http://afsc.org/
Australian Greens http://greens.org.au
BREAZE http://breaze.org.au
Canadian Paramedics http://www.peelparamedics.com
Community Builders Australia Pty Ltd
Corvair Society of America (CORSA) http://www.corvair.org/
Donor Depot http://donordepot.com
Energetica http://energetica.com.au
Fuzion http://fuzion.co.nz
Gold Strategy Group http://www.goldstrategygroup.com
JMA Consulting http://jmaconsulting.biz
Joomkit Ltd http://joomkit.com
Kabissa - Space for Change in Africa http://kabissa.org
NS Web Solutions http://nswebsolutions.com
NAMI Louisville http://namilouisville.org
Progressive Technology Project http://www.progressivetech.org
RVTC http://rvtc.us
Volunteer Honduras http://www.volunteerhonduras.org
Briney, Matthew
Brownsberger, Will
Burden, Monica
Calleeuw, Bart
Cimpian, Casti
Clarke, Jill
Davis, Peter
Day, Janette
Gold, Ariel
Hadar, Kehilat
Malkoun, Anthony
Matsushita, Jun
McNaughton, Eileen
Murray, Joe
Shaughnessy, Brian
Spagarino, Andres
Speleo
Stuart, josh
Tabletguy
Watts, Danny
Wistreich, Nic
****************************************
Sponsors for 3.3 Make-it-Happen Projects
****************************************
The following people and organizations sponsored new and improved features for the 3.3 release.
JMA Consulting: http://jmaconsulting.biz/
Emergency Picnic: http://emergencypicnic.net/
Thomas Carlson
Micheas Herman
T.J. Hellman
Gold Strategy Group: http://www.goldstrategygroup.com
Laura Velkei
John Barclay
Matthew Briney: http://emotivellc.com
2020Media: http://www.2020media.com/
Social Contxt: http://socialcontxt.com/
Impari Systems Inc: http://www.imparisystems.com/
Alpha: http://uk.alpha.org
Cambridge Union: http://www.cus.org
St Ethelburga's: http://stethelburgas.org
Joomkit: http://www.joomkit.com
International Mountain Biking Association: http://www.imba.com/
Niro Solutions: http://www.nirosolutions.com/
Fuzion: http://fuzion.co.nz
ArtD Webdesign
CivicActions: http://civicactions.com/
NES Alumni and Friends Nonprofit Partnership: https://www.nesalumni.org/en
Gold Strategy Group: http://www.goldstrategygroup.com
Creative Commons: http://creativecommons.org/
Community Builders Australia Pty Ltd: http://www.communitybuilders.com.au/
Australian Greens: http://greens.org.au/
NES Alumni and Friends Nonprofit Partnership: https://www.nesalumni.org/en
Data-Scribe: http://www.datascribe.biz/
Rayogram: http://www.rayogram.com/
GingerFeet LLC: http://www.gingerfeet.com/
Kabissa: http://kabissa.org
Beth Hynes-Ciernia
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*/
class CRM_ACL_API {
/**
* The various type of permissions.
*
* @var int
*/
const EDIT = 1;
const VIEW = 2;
const DELETE = 3;
const CREATE = 4;
const SEARCH = 5;
const ALL = 6;
/**
* Given a permission string, check for access requirements
*
* @param string $str
* The permission to check.
* @param int $contactID
* The contactID for whom the check is made.
*
* @return bool
* true if yes, else false
*/
public static function check($str, $contactID = NULL) {
if ($contactID == NULL) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
}
if (!$contactID) {
// anonymous user
$contactID = 0;
}
return CRM_ACL_BAO_ACL::check($str, $contactID);
}
/**
* Get the permissioned where clause for the user.
*
* @param int $type
* The type of permission needed.
* @param array $tables
* (reference ) add the tables that are needed for the select clause.
* @param array $whereTables
* (reference ) add the tables that are needed for the where clause.
* @param int $contactID
* The contactID for whom the check is made.
* @param bool $onlyDeleted
* Whether to include only deleted contacts.
* @param bool $skipDeleteClause
* Don't add delete clause if this is true,.
* this means it is handled by generating query
*
* @return string
* the group where clause for this user
*/
public static function whereClause(
$type,
&$tables,
&$whereTables,
$contactID = NULL,
$onlyDeleted = FALSE,
$skipDeleteClause = FALSE
) {
// the default value which is valid for the final AND
$deleteClause = ' ( 1 ) ';
if (!$skipDeleteClause) {
if (CRM_Core_Permission::check('access deleted contacts') and $onlyDeleted) {
$deleteClause = '(contact_a.is_deleted)';
}
else {
// CRM-6181
$deleteClause = '(contact_a.is_deleted = 0)';
}
}
// first see if the contact has edit / view all contacts
if (CRM_Core_Permission::check('edit all contacts') ||
($type == self::VIEW && CRM_Core_Permission::check('view all contacts'))
) {
return $deleteClause;
}
if (!$contactID) {
$contactID = CRM_Core_Session::getLoggedInContactID();
}
$contactID = (int) $contactID;
$where = implode(' AND ',
array(
CRM_ACL_BAO_ACL::whereClause($type,
$tables,
$whereTables,
$contactID
),
$deleteClause,
)
);
// Add permission on self
if ($contactID && (CRM_Core_Permission::check('edit my contact') ||
$type == self::VIEW && CRM_Core_Permission::check('view my contact'))
) {
$where = "(contact_a.id = $contactID OR ($where))";
}
return $where;
}
/**
* Get all the groups the user has access to for the given operation.
*
* @param int $type
* The type of permission needed.
* @param int $contactID
* The contactID for whom the check is made.
*
* @param string $tableName
* @param null $allGroups
* @param null $includedGroups
*
* @return array
* the ids of the groups for which the user has permissions
*/
public static function group(
$type,
$contactID = NULL,
$tableName = 'civicrm_saved_search',
$allGroups = NULL,
$includedGroups = NULL
) {
if ($contactID == NULL) {
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
}
if (!$contactID) {
// anonymous user
$contactID = 0;
}
return CRM_ACL_BAO_ACL::group($type, $contactID, $tableName, $allGroups, $includedGroups);
}
/**
* Check if the user has access to this group for operation $type
*
* @param int $type
* The type of permission needed.
* @param int $groupID
* @param int $contactID
* The contactID for whom the check is made.
* @param string $tableName
* @param null $allGroups
* @param null $includedGroups
* @param bool $flush
*
* @return array
* the ids of the groups for which the user has permissions
*/
public static function groupPermission(
$type,
$groupID,
$contactID = NULL,
$tableName = 'civicrm_saved_search',
$allGroups = NULL,
$includedGroups = NULL,
$flush = FALSE
) {
static $cache = array();
$groups = array();
//@todo this is pretty hacky!!!
//adding a way for unit tests to flush the cache
if ($flush) {
$cache = array();
return NULL;
}
if (!$contactID) {
$session = CRM_Core_Session::singleton();
$contactID = NULL;
if ($session->get('userID')) {
$contactID = $session->get('userID');
}
}
$key = "{$tableName}_{$type}_{$contactID}";
if (array_key_exists($key, $cache)) {
$groups = &$cache[$key];
}
else {
$groups = self::group($type, $contactID, $tableName, $allGroups, $includedGroups);
$cache[$key] = $groups;
}
if (empty($groups)) {
return FALSE;
}
return in_array($groupID, $groups) ? TRUE : FALSE;
}
}
This diff is collapsed.
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*/
/**
* Access Control Cache.
*/
class CRM_ACL_BAO_Cache extends CRM_ACL_DAO_Cache {
static $_cache = NULL;
/**
* @param int $id
*
* @return mixed
*/
public static function &build($id) {
if (!self::$_cache) {
self::$_cache = array();
}
if (array_key_exists($id, self::$_cache)) {
return self::$_cache[$id];
}
// check if this entry exists in db
// if so retrieve and return
self::$_cache[$id] = self::retrieve($id);
if (self::$_cache[$id]) {
return self::$_cache[$id];
}
self::$_cache[$id] = CRM_ACL_BAO_ACL::getAllByContact($id);
self::store($id, self::$_cache[$id]);
return self::$_cache[$id];
}
/**
* @param int $id
*
* @return array
*/
public static function retrieve($id) {
$query = "
SELECT acl_id
FROM civicrm_acl_cache
WHERE contact_id = %1
";
$params = array(1 => array($id, 'Integer'));
if ($id == 0) {
$query .= " OR contact_id IS NULL";
}
$dao = CRM_Core_DAO::executeQuery($query, $params);
$cache = array();
while ($dao->fetch()) {
$cache[$dao->acl_id] = 1;
}
return $cache;
}
/**
* @param int $id
* @param array $cache
*/
public static function store($id, &$cache) {
foreach ($cache as $aclID => $data) {
$dao = new CRM_ACL_DAO_Cache();
if ($id) {
$dao->contact_id = $id;
}
$dao->acl_id = $aclID;
$cache[$aclID] = 1;
$dao->save();
}
}
/**
* @param int $id
*/
public static function deleteEntry($id) {
if (self::$_cache &&
array_key_exists($id, self::$_cache)
) {
unset(self::$_cache[$id]);
}
$query = "
DELETE FROM civicrm_acl_cache
WHERE contact_id = %1
";
$params = array(1 => array($id, 'Integer'));
CRM_Core_DAO::executeQuery($query, $params);
}
/**
* @param int $id
*/
public static function updateEntry($id) {
// rebuilds civicrm_acl_cache
self::deleteEntry($id);
self::build($id);
// rebuilds civicrm_acl_contact_cache
CRM_Contact_BAO_Contact_Permission::cache($id, CRM_Core_Permission::VIEW, TRUE);
}
/**
* Deletes all the cache entries.
*/
public static function resetCache() {
// reset any static caching
self::$_cache = NULL;
// reset any db caching
$config = CRM_Core_Config::singleton();
$smartGroupCacheTimeout = CRM_Contact_BAO_GroupContactCache::smartGroupCacheTimeout();
//make sure to give original timezone settings again.
$now = CRM_Utils_Date::getUTCTime();
$query = "
DELETE
FROM civicrm_acl_cache
WHERE modified_date IS NULL
OR (TIMESTAMPDIFF(MINUTE, modified_date, $now) >= $smartGroupCacheTimeout)
";
CRM_Core_DAO::singleValueQuery($query);
// CRM_Core_DAO::singleValueQuery("TRUNCATE TABLE civicrm_acl_contact_cache"); // No, force-commits transaction
// CRM_Core_DAO::singleValueQuery("DELETE FROM civicrm_acl_contact_cache"); // Transaction-safe
if (CRM_Core_Transaction::isActive()) {
CRM_Core_Transaction::addCallback(CRM_Core_Transaction::PHASE_POST_COMMIT, function () {
CRM_Core_DAO::singleValueQuery("TRUNCATE TABLE civicrm_acl_contact_cache");
});
}
else {
CRM_Core_DAO::singleValueQuery("TRUNCATE TABLE civicrm_acl_contact_cache");
}
}
}
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*/
/**
* Access Control EntityRole.
*/
class CRM_ACL_BAO_EntityRole extends CRM_ACL_DAO_EntityRole {
static $_entityTable = NULL;
/**
* Get entity table.
*
* @return array|null
*/
public static function entityTable() {
if (!self::$_entityTable) {
self::$_entityTable = array(
'civicrm_contact' => ts('Contact'),
'civicrm_group' => ts('Group'),
);
}
return self::$_entityTable;
}
/**
* @param array $params
*
* @return CRM_ACL_DAO_EntityRole
*/
public static function create(&$params) {
$dao = new CRM_ACL_DAO_EntityRole();
$dao->copyValues($params);
$dao->save();
return $dao;
}
/**
* @param array $params
* @param $defaults
*/
public static function retrieve(&$params, &$defaults) {
CRM_Core_DAO::commonRetrieve('CRM_ACL_DAO_EntityRole', $params, $defaults);
}
/**
* Update the is_active flag in the db.
*
* @param int $id
* Id of the database record.
* @param bool $is_active
* Value we want to set the is_active field.
*
* @return Object
* DAO object on success, null otherwise
*/
public static function setIsActive($id, $is_active) {
return CRM_Core_DAO::setFieldValue('CRM_ACL_DAO_EntityRole', $id, 'is_active', $is_active);
}
/**
* Delete Entity Role records.
*
* @param int $entityRoleId
* ID of the EntityRole record to be deleted.
*
*/
public static function del($entityRoleId) {
$entityDAO = new CRM_ACL_DAO_EntityRole();
$entityDAO->id = $entityRoleId;
$entityDAO->find(TRUE);
$entityDAO->delete();
}
}
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*
* Generated from xml/schema/CRM/ACL/ACL.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
class CRM_ACL_DAO_ACL extends CRM_Core_DAO
{
/**
* static instance to hold the table name
*
* @var string
*/
static $_tableName = 'civicrm_acl';
/**
* static instance to hold the field values
*
* @var array
*/
static $_fields = null;
/**
* static instance to hold the keys used in $_fields for each field.
*
* @var array
*/
static $_fieldKeys = null;
/**
* static instance to hold the FK relationships
*
* @var string
*/
static $_links = null;
/**
* static instance to hold the values that can
* be imported
*
* @var array
*/
static $_import = null;
/**
* static instance to hold the values that can
* be exported
*
* @var array
*/
static $_export = null;
/**
* static value to see if we should log any modifications to
* this table in the civicrm_log table
*
* @var boolean
*/
static $_log = false;
/**
* Unique table ID
*
* @var int unsigned
*/
public $id;
/**
* ACL Name.
*
* @var string
*/
public $name;
/**
* Is this ACL entry Allow (0) or Deny (1) ?
*
* @var boolean
*/
public $deny;
/**
* Table of the object possessing this ACL entry (Contact, Group, or ACL Group)
*
* @var string
*/
public $entity_table;
/**
* ID of the object possessing this ACL
*
* @var int unsigned
*/
public $entity_id;
/**
* What operation does this ACL entry control?
*
* @var string
*/
public $operation;
/**
* The table of the object controlled by this ACL entry
*
* @var string
*/
public $object_table;
/**
* The ID of the object controlled by this ACL entry
*
* @var int unsigned
*/
public $object_id;
/**
* If this is a grant/revoke entry, what table are we granting?
*
* @var string
*/
public $acl_table;
/**
* ID of the ACL or ACL group being granted/revoked
*
* @var int unsigned
*/
public $acl_id;
/**
* Is this property active?
*
* @var boolean
*/
public $is_active;
/**
* class constructor
*
* @return civicrm_acl
*/
function __construct()
{
$this->__table = 'civicrm_acl';
parent::__construct();
}
/**
* Returns foreign keys and entity references
*
* @return array
* [CRM_Core_Reference_Interface]
*/
static function getReferenceColumns()
{
if (!self::$_links) {
self::$_links = static ::createReferenceColumns(__CLASS__);
self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
}
return self::$_links;
}
/**
* Returns all the column names of this table
*
* @return array
*/
static function &fields()
{
if (!(self::$_fields)) {
self::$_fields = array(
'id' => array(
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('ACL ID') ,
'description' => 'Unique table ID',
'required' => true,
) ,
'name' => array(
'name' => 'name',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('ACL Name') ,
'description' => 'ACL Name.',
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
'html' => array(
'type' => 'Text',
) ,
) ,
'deny' => array(
'name' => 'deny',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Deny ACL?') ,
'description' => 'Is this ACL entry Allow (0) or Deny (1) ?',
'required' => true,
'html' => array(
'type' => 'Radio',
) ,
) ,
'entity_table' => array(
'name' => 'entity_table',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('ACL Entity') ,
'description' => 'Table of the object possessing this ACL entry (Contact, Group, or ACL Group)',
'required' => true,
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
) ,
'entity_id' => array(
'name' => 'entity_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Entity ID') ,
'description' => 'ID of the object possessing this ACL',
) ,
'operation' => array(
'name' => 'operation',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('ACL Operation') ,
'description' => 'What operation does this ACL entry control?',
'required' => true,
'maxlength' => 8,
'size' => CRM_Utils_Type::EIGHT,
'html' => array(
'type' => 'Select',
) ,
'pseudoconstant' => array(
'callback' => 'CRM_ACL_BAO_ACL::operation',
)
) ,
'object_table' => array(
'name' => 'object_table',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('ACL Object') ,
'description' => 'The table of the object controlled by this ACL entry',
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
) ,
'object_id' => array(
'name' => 'object_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('ACL Object ID') ,
'description' => 'The ID of the object controlled by this ACL entry',
) ,
'acl_table' => array(
'name' => 'acl_table',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('ACL Table') ,
'description' => 'If this is a grant/revoke entry, what table are we granting?',
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
) ,
'acl_id' => array(
'name' => 'acl_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('ACL Group ID') ,
'description' => 'ID of the ACL or ACL group being granted/revoked',
) ,
'is_active' => array(
'name' => 'is_active',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('ACL Is Active?') ,
'description' => 'Is this property active?',
'html' => array(
'type' => 'Checkbox',
) ,
) ,
);
}
return self::$_fields;
}
/**
* Returns an array containing, for each field, the arary key used for that
* field in self::$_fields.
*
* @return array
*/
static function &fieldKeys()
{
if (!(self::$_fieldKeys)) {
self::$_fieldKeys = array(
'id' => 'id',
'name' => 'name',
'deny' => 'deny',
'entity_table' => 'entity_table',
'entity_id' => 'entity_id',
'operation' => 'operation',
'object_table' => 'object_table',
'object_id' => 'object_id',
'acl_table' => 'acl_table',
'acl_id' => 'acl_id',
'is_active' => 'is_active',
);
}
return self::$_fieldKeys;
}
/**
* Returns the names of this table
*
* @return string
*/
static function getTableName()
{
return self::$_tableName;
}
/**
* Returns if this table needs to be logged
*
* @return boolean
*/
function getLog()
{
return self::$_log;
}
/**
* Returns the list of fields that can be imported
*
* @param bool $prefix
*
* @return array
*/
static function &import($prefix = false)
{
if (!(self::$_import)) {
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('import', $field)) {
if ($prefix) {
self::$_import['acl'] = & $fields[$name];
} else {
self::$_import[$name] = & $fields[$name];
}
}
}
}
return self::$_import;
}
/**
* Returns the list of fields that can be exported
*
* @param bool $prefix
*
* @return array
*/
static function &export($prefix = false)
{
if (!(self::$_export)) {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('export', $field)) {
if ($prefix) {
self::$_export['acl'] = & $fields[$name];
} else {
self::$_export[$name] = & $fields[$name];
}
}
}
}
return self::$_export;
}
}
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*
* Generated from xml/schema/CRM/ACL/Cache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
class CRM_ACL_DAO_Cache extends CRM_Core_DAO
{
/**
* static instance to hold the table name
*
* @var string
*/
static $_tableName = 'civicrm_acl_cache';
/**
* static instance to hold the field values
*
* @var array
*/
static $_fields = null;
/**
* static instance to hold the keys used in $_fields for each field.
*
* @var array
*/
static $_fieldKeys = null;
/**
* static instance to hold the FK relationships
*
* @var string
*/
static $_links = null;
/**
* static instance to hold the values that can
* be imported
*
* @var array
*/
static $_import = null;
/**
* static instance to hold the values that can
* be exported
*
* @var array
*/
static $_export = null;
/**
* static value to see if we should log any modifications to
* this table in the civicrm_log table
*
* @var boolean
*/
static $_log = false;
/**
* Unique table ID
*
* @var int unsigned
*/
public $id;
/**
* Foreign Key to Contact
*
* @var int unsigned
*/
public $contact_id;
/**
* Foreign Key to ACL
*
* @var int unsigned
*/
public $acl_id;
/**
* When was this cache entry last modified
*
* @var date
*/
public $modified_date;
/**
* class constructor
*
* @return civicrm_acl_cache
*/
function __construct()
{
$this->__table = 'civicrm_acl_cache';
parent::__construct();
}
/**
* Returns foreign keys and entity references
*
* @return array
* [CRM_Core_Reference_Interface]
*/
static function getReferenceColumns()
{
if (!self::$_links) {
self::$_links = static ::createReferenceColumns(__CLASS__);
self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'contact_id', 'civicrm_contact', 'id');
self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'acl_id', 'civicrm_acl', 'id');
}
return self::$_links;
}
/**
* Returns all the column names of this table
*
* @return array
*/
static function &fields()
{
if (!(self::$_fields)) {
self::$_fields = array(
'id' => array(
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Cache ID') ,
'description' => 'Unique table ID',
'required' => true,
) ,
'contact_id' => array(
'name' => 'contact_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Cache Contact') ,
'description' => 'Foreign Key to Contact',
'FKClassName' => 'CRM_Contact_DAO_Contact',
) ,
'acl_id' => array(
'name' => 'acl_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Cache ACL') ,
'description' => 'Foreign Key to ACL',
'required' => true,
'FKClassName' => 'CRM_ACL_DAO_ACL',
) ,
'modified_date' => array(
'name' => 'modified_date',
'type' => CRM_Utils_Type::T_DATE,
'title' => ts('Cache Modified Date') ,
'description' => 'When was this cache entry last modified',
) ,
);
}
return self::$_fields;
}
/**
* Returns an array containing, for each field, the arary key used for that
* field in self::$_fields.
*
* @return array
*/
static function &fieldKeys()
{
if (!(self::$_fieldKeys)) {
self::$_fieldKeys = array(
'id' => 'id',
'contact_id' => 'contact_id',
'acl_id' => 'acl_id',
'modified_date' => 'modified_date',
);
}
return self::$_fieldKeys;
}
/**
* Returns the names of this table
*
* @return string
*/
static function getTableName()
{
return self::$_tableName;
}
/**
* Returns if this table needs to be logged
*
* @return boolean
*/
function getLog()
{
return self::$_log;
}
/**
* Returns the list of fields that can be imported
*
* @param bool $prefix
*
* @return array
*/
static function &import($prefix = false)
{
if (!(self::$_import)) {
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('import', $field)) {
if ($prefix) {
self::$_import['acl_cache'] = & $fields[$name];
} else {
self::$_import[$name] = & $fields[$name];
}
}
}
}
return self::$_import;
}
/**
* Returns the list of fields that can be exported
*
* @param bool $prefix
*
* @return array
*/
static function &export($prefix = false)
{
if (!(self::$_export)) {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('export', $field)) {
if ($prefix) {
self::$_export['acl_cache'] = & $fields[$name];
} else {
self::$_export[$name] = & $fields[$name];
}
}
}
}
return self::$_export;
}
}
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*
* Generated from xml/schema/CRM/ACL/EntityRole.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
class CRM_ACL_DAO_EntityRole extends CRM_Core_DAO
{
/**
* static instance to hold the table name
*
* @var string
*/
static $_tableName = 'civicrm_acl_entity_role';
/**
* static instance to hold the field values
*
* @var array
*/
static $_fields = null;
/**
* static instance to hold the keys used in $_fields for each field.
*
* @var array
*/
static $_fieldKeys = null;
/**
* static instance to hold the FK relationships
*
* @var string
*/
static $_links = null;
/**
* static instance to hold the values that can
* be imported
*
* @var array
*/
static $_import = null;
/**
* static instance to hold the values that can
* be exported
*
* @var array
*/
static $_export = null;
/**
* static value to see if we should log any modifications to
* this table in the civicrm_log table
*
* @var boolean
*/
static $_log = false;
/**
* Unique table ID
*
* @var int unsigned
*/
public $id;
/**
* Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)
*
* @var int unsigned
*/
public $acl_role_id;
/**
* Table of the object joined to the ACL Role (Contact or Group)
*
* @var string
*/
public $entity_table;
/**
* ID of the group/contact object being joined
*
* @var int unsigned
*/
public $entity_id;
/**
* Is this property active?
*
* @var boolean
*/
public $is_active;
/**
* class constructor
*
* @return civicrm_acl_entity_role
*/
function __construct()
{
$this->__table = 'civicrm_acl_entity_role';
parent::__construct();
}
/**
* Returns foreign keys and entity references
*
* @return array
* [CRM_Core_Reference_Interface]
*/
static function getReferenceColumns()
{
if (!self::$_links) {
self::$_links = static ::createReferenceColumns(__CLASS__);
self::$_links[] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
}
return self::$_links;
}
/**
* Returns all the column names of this table
*
* @return array
*/
static function &fields()
{
if (!(self::$_fields)) {
self::$_fields = array(
'id' => array(
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Entity Role') ,
'description' => 'Unique table ID',
'required' => true,
) ,
'acl_role_id' => array(
'name' => 'acl_role_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('ACL Role ID') ,
'description' => 'Foreign Key to ACL Role (which is an option value pair and hence an implicit FK)',
'required' => true,
) ,
'entity_table' => array(
'name' => 'entity_table',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Entity Table') ,
'description' => 'Table of the object joined to the ACL Role (Contact or Group)',
'required' => true,
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
) ,
'entity_id' => array(
'name' => 'entity_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('ACL Entity ID') ,
'description' => 'ID of the group/contact object being joined',
'required' => true,
) ,
'is_active' => array(
'name' => 'is_active',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('ACL Entity Role is Active') ,
'description' => 'Is this property active?',
) ,
);
}
return self::$_fields;
}
/**
* Returns an array containing, for each field, the arary key used for that
* field in self::$_fields.
*
* @return array
*/
static function &fieldKeys()
{
if (!(self::$_fieldKeys)) {
self::$_fieldKeys = array(
'id' => 'id',
'acl_role_id' => 'acl_role_id',
'entity_table' => 'entity_table',
'entity_id' => 'entity_id',
'is_active' => 'is_active',
);
}
return self::$_fieldKeys;
}
/**
* Returns the names of this table
*
* @return string
*/
static function getTableName()
{
return self::$_tableName;
}
/**
* Returns if this table needs to be logged
*
* @return boolean
*/
function getLog()
{
return self::$_log;
}
/**
* Returns the list of fields that can be imported
*
* @param bool $prefix
*
* @return array
*/
static function &import($prefix = false)
{
if (!(self::$_import)) {
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('import', $field)) {
if ($prefix) {
self::$_import['acl_entity_role'] = & $fields[$name];
} else {
self::$_import[$name] = & $fields[$name];
}
}
}
}
return self::$_import;
}
/**
* Returns the list of fields that can be exported
*
* @param bool $prefix
*
* @return array
*/
static function &export($prefix = false)
{
if (!(self::$_export)) {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('export', $field)) {
if ($prefix) {
self::$_export['acl_entity_role'] = & $fields[$name];
} else {
self::$_export[$name] = & $fields[$name];
}
}
}
}
return self::$_export;
}
}
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
*/
class CRM_ACL_Form_ACL extends CRM_Admin_Form {
/**
* Set default values for the form.
*/
public function setDefaultValues() {
$defaults = parent::setDefaultValues();
if ($this->_action & CRM_Core_Action::ADD) {
$defaults['object_type'] = 1;
}
$showHide = new CRM_Core_ShowHideBlocks();
if (isset($defaults['object_table'])) {
switch ($defaults['object_table']) {
case 'civicrm_saved_search':
$defaults['group_id'] = $defaults['object_id'];
$defaults['object_type'] = 1;
$showHide->addShow("id-group-acl");
$showHide->addHide("id-profile-acl");
$showHide->addHide("id-custom-acl");
$showHide->addHide("id-event-acl");
break;
case 'civicrm_uf_group':
$defaults['uf_group_id'] = $defaults['object_id'];
$defaults['object_type'] = 2;
$showHide->addHide("id-group-acl");
$showHide->addShow("id-profile-acl");
$showHide->addHide("id-custom-acl");
$showHide->addHide("id-event-acl");
break;
case 'civicrm_custom_group':
$defaults['custom_group_id'] = $defaults['object_id'];
$defaults['object_type'] = 3;
$showHide->addHide("id-group-acl");
$showHide->addHide("id-profile-acl");
$showHide->addShow("id-custom-acl");
$showHide->addHide("id-event-acl");
break;
case 'civicrm_event':
$defaults['event_id'] = $defaults['object_id'];
$defaults['object_type'] = 4;
$showHide->addHide("id-group-acl");
$showHide->addHide("id-profile-acl");
$showHide->addHide("id-custom-acl");
$showHide->addShow("id-event-acl");
break;
}
}
else {
$showHide->addHide("id-group-acl");
$showHide->addHide("id-profile-acl");
$showHide->addHide("id-custom-acl");
$showHide->addHide("id-event-acl");
}
// Don't assign showHide elements to template in DELETE mode (fields to be shown and hidden don't exist)
if (!($this->_action & CRM_Core_Action::DELETE)) {
$showHide->addToTemplate();
}
return $defaults;
}
/**
* Build the form object.
*/
public function buildQuickForm() {
parent::buildQuickForm();
$this->setPageTitle(ts('ACL'));
if ($this->_action & CRM_Core_Action::DELETE) {
return;
}
$attributes = CRM_Core_DAO::getAttribute('CRM_ACL_DAO_ACL');
$this->add('text', 'name', ts('Description'), CRM_Core_DAO::getAttribute('CRM_ACL_DAO_ACL', 'name'), TRUE);
$operations = array('' => ts('- select -')) + CRM_ACL_BAO_ACL::operation();
$this->add('select',
'operation',
ts('Operation'),
$operations, TRUE
);
$objTypes = array(
'1' => ts('A group of contacts'),
'2' => ts('A profile'),
'3' => ts('A set of custom data fields'),
);
if (CRM_Core_Permission::access('CiviEvent')) {
$objTypes['4'] = ts('Events');
}
$extra = array('onclick' => "showObjectSelect();");
$this->addRadio('object_type',
ts('Type of Data'),
$objTypes,
$extra,
'&nbsp;', TRUE
);
$label = ts('Role');
$role = array(
'-1' => ts('- select role -'),
'0' => ts('Everyone'),
) + CRM_Core_OptionGroup::values('acl_role');
$this->add('select', 'entity_id', $label, $role, TRUE);
$group = array(
'-1' => ts('- select -'),
'0' => ts('All Groups'),
) + CRM_Core_PseudoConstant::group();
$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 -'),
'0' => ts('All Profiles'),
) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id');
$event = array(
'-1' => ts('- select -'),
'0' => ts('All Events'),
) + CRM_Event_PseudoConstant::event(NULL, FALSE, "( is_template IS NULL OR is_template != 1 )");
$this->add('select', 'group_id', ts('Group'), $group);
$this->add('select', 'custom_group_id', ts('Custom Data'), $customGroup);
$this->add('select', 'uf_group_id', ts('Profile'), $ufGroup);
$this->add('select', 'event_id', ts('Event'), $event);
$this->add('checkbox', 'is_active', ts('Enabled?'));
$this->addFormRule(array('CRM_ACL_Form_ACL', 'formRule'));
}
/**
* @param array $params
*
* @return bool
*/
public static function formRule($params) {
$showHide = new CRM_Core_ShowHideBlocks();
// Make sure role is not -1
if ($params['entity_id'] == -1) {
$errors['entity_id'] = ts('Please assign this permission to a Role.');
}
$validOperations = array('View', 'Edit');
$operationMessage = ts("Only 'View' and 'Edit' operations are valid for this type of data");
// Figure out which type of object we're permissioning on and make sure user has selected a value.
switch ($params['object_type']) {
case 1:
if ($params['group_id'] == -1) {
$errors['group_id'] = ts('Please select a Group (or ALL Groups).');
$showHide->addShow("id-group-acl");
$showHide->addHide("id-profile-acl");
$showHide->addHide("id-custom-acl");
$showHide->addHide("id-event-acl");
}
if (!in_array($params['operation'], $validOperations)) {
$errors['operation'] = $operationMessage;
}
break;
case 2:
if ($params['uf_group_id'] == -1) {
$errors['uf_group_id'] = ts('Please select a Profile (or ALL Profiles).');
$showHide->addShow("id-profile-acl");
$showHide->addHide("id-group-acl");
$showHide->addHide("id-custom-acl");
$showHide->addHide("id-event-acl");
}
break;
case 3:
if ($params['custom_group_id'] == -1) {
$errors['custom_group_id'] = ts('Please select a set of Custom Data (or ALL Custom Data).');
$showHide->addShow("id-custom-acl");
$showHide->addHide("id-group-acl");
$showHide->addHide("id-profile-acl");
$showHide->addHide("id-event-acl");
}
if (!in_array($params['operation'], $validOperations)) {
$errors['operation'] = $operationMessage;
}
break;
case 4:
if ($params['event_id'] == -1) {
$errors['event_id'] = ts('Please select an Event (or ALL Events).');
$showHide->addShow("id-event-acl");
$showHide->addHide("id-custom-acl");
$showHide->addHide("id-group-acl");
$showHide->addHide("id-profile-acl");
}
if (!in_array($params['operation'], $validOperations)) {
$errors['operation'] = $operationMessage;
}
break;
}
$showHide->addToTemplate();
return empty($errors) ? TRUE : $errors;
}
/**
* Process the form submission.
*/
public function postProcess() {
// 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');
}
else {
$params = $this->controller->exportValues($this->_name);
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
$params['deny'] = 0;
$params['entity_table'] = 'civicrm_acl_role';
// Figure out which type of object we're permissioning on and set object_table and object_id.
switch ($params['object_type']) {
case 1:
$params['object_table'] = 'civicrm_saved_search';
$params['object_id'] = $params['group_id'];
break;
case 2:
$params['object_table'] = 'civicrm_uf_group';
$params['object_id'] = $params['uf_group_id'];
break;
case 3:
$params['object_table'] = 'civicrm_custom_group';
$params['object_id'] = $params['custom_group_id'];
break;
case 4:
$params['object_table'] = 'civicrm_event';
$params['object_id'] = $params['event_id'];
break;
}
if ($this->_id) {
$params['id'] = $this->_id;
}
CRM_ACL_BAO_ACL::create($params);
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment