3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2014
39 * @copyright CiviCRM LLC (c) 2004-2014
43 class CRM_ACL_Page_ACLBasic
extends CRM_Core_Page_Basic
{
46 * The action links that we need to display for the browse screen.
50 static $_links = NULL;
58 public function getBAOName() {
59 return 'CRM_ACL_BAO_ACL';
66 * (reference) of action links
68 public function &links() {
69 if (!(self
::$_links)) {
70 self
::$_links = array(
71 CRM_Core_Action
::UPDATE
=> array(
73 'url' => 'civicrm/acl/basic',
74 'qs' => 'reset=1&action=update&id=%%id%%',
75 'title' => ts('Edit ACL'),
77 CRM_Core_Action
::DELETE
=> array(
78 'name' => ts('Delete'),
79 'url' => 'civicrm/acl/basic',
80 'qs' => 'reset=1&action=delete&id=%%id%%',
81 'title' => ts('Delete ACL'),
91 * This method is called after the page is created. It checks for the
92 * type of action and executes that action.
93 * Finally it calls the parent's run method.
97 public function run() {
98 // get the requested action
99 $action = CRM_Utils_Request
::retrieve('action', 'String',
100 // default to 'browse'
101 $this, FALSE, 'browse'
104 // assign vars to templates
105 $this->assign('action', $action);
106 $id = CRM_Utils_Request
::retrieve('id', 'Positive',
110 // set breadcrumb to append to admin/access
113 'title' => ts('Access Control'),
114 'url' => CRM_Utils_System
::url('civicrm/admin/access', 'reset=1'),
117 CRM_Utils_System
::appendBreadCrumb($breadCrumb);
119 // what action to take ?
120 if ($action & (CRM_Core_Action
::UPDATE | CRM_Core_Action
::ADD | CRM_Core_Action
::DELETE
)) {
121 $this->edit($action, $id);
124 // finally browse the acl's
128 return parent
::run();
136 public function browse() {
138 // get all acl's sorted by weight
143 WHERE ( object_table NOT IN ( 'civicrm_saved_search', 'civicrm_uf_group', 'civicrm_custom_group' ) )
146 $dao = CRM_Core_DAO
::executeQuery($query,
147 CRM_Core_DAO
::$_nullArray
150 $roles = CRM_Core_OptionGroup
::values('acl_role');
152 $permissions = CRM_Core_Permission
::basicPermissions();
153 while ($dao->fetch()) {
154 if (!array_key_exists($dao->entity_id
, $acl)) {
155 $acl[$dao->entity_id
] = array();
156 $acl[$dao->entity_id
]['name'] = $dao->name
;
157 $acl[$dao->entity_id
]['entity_id'] = $dao->entity_id
;
158 $acl[$dao->entity_id
]['entity_table'] = $dao->entity_table
;
159 $acl[$dao->entity_id
]['object_table'] = CRM_Utils_Array
::value($dao->object_table
, $permissions);
160 $acl[$dao->entity_id
]['is_active'] = 1;
162 if ($acl[$dao->entity_id
]['entity_id']) {
163 $acl[$dao->entity_id
]['entity'] = $roles[$acl[$dao->entity_id
]['entity_id']];
166 $acl[$dao->entity_id
]['entity'] = ts('Any Role');
169 // form all action links
170 $action = array_sum(array_keys($this->links()));
172 $acl[$dao->entity_id
]['action'] = CRM_Core_Action
::formLink(
175 array('id' => $dao->entity_id
),
178 'aclRole.manage.action',
183 elseif (!empty($permissions[$dao->object_table
])) {
184 $acl[$dao->entity_id
]['object_table'] .= ", {$permissions[$dao->object_table]}";
187 $this->assign('rows', $acl);
191 * Get name of edit form.
194 * Classname of edit form.
196 public function editForm() {
197 return 'CRM_ACL_Form_ACLBasic';
201 * Get edit form name.
206 public function editName() {
218 public function userContext($mode = NULL) {
219 return 'civicrm/acl/basic';