PluginProbe
VikBooking Hotel Booking Engine & PMS / trunk
VikBooking Hotel Booking Engine & PMS vtrunk
1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 All 35 releases
vikbooking / admin / models / acl.php

acl.php in VikBooking Hotel Booking Engine & PMS trunk, at admin/models/acl.php

62 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package VikBooking
4 * @subpackage com_vikbooking
5 * @author E4J srl
6 * @copyright Copyright (C) e4j - Extensionsforjoomla.com. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 JLoader::import('adapter.mvc.models.form');
15
16 /**
17 * VikBooking plugin ACL model.
18 *
19 * @since 1.0
20 * @see JModelForm
21 */
22 class VikBookingModelAcl extends JModelForm
23 {
24 /**
25 * A list containing the roles to ignore.
26 *
27 * @var array
28 */
29 private $ignores = array('administrator');
30
31 /**
32 * @override
33 * Updates the ACL for the existing Wordpress user roles.
34 *
35 * @param array &$data The array data containing the ACL rules.
36 *
37 * @return boolean True on success, otherwise false.
38 */
39 public function save(&$data)
40 {
41 foreach ($data as $slug => $actions)
42 {
43 $role = get_role($slug);
44
45 if ($role && !in_array($slug, $this->ignores))
46 {
47 foreach ($actions as $cap => $has)
48 {
49 $has = (int) $has;
50
51 if ($has != -1)
52 {
53 $b = $role->add_cap($cap, (bool) $has);
54 }
55 }
56 }
57 }
58
59 return true;
60 }
61 }
62