3
* Xibo - Digitial Signage - http://www.xibo.org.uk
4
* Copyright (C) 2011 Daniel Garner
6
* This file is part of Xibo.
8
* Xibo is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU Affero General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
13
* Xibo is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU Affero General Public License for more details.
18
* You should have received a copy of the GNU Affero General Public License
19
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
21
defined('XIBO') or die('Sorry, you are not allowed to directly access this page.<br /> Please press the back button in your browser.');
23
class DataSetGroupSecurity extends Data
25
public function __construct(database $db)
27
parent::__construct($db);
31
* Links a Display Group to a Group
33
* @param $displayGroupID Object
34
* @param $groupID Object
36
public function Link($dataSetId, $groupId, $view, $edit, $del)
40
Debug::LogEntry($db, 'audit', 'IN', 'DataSetGroupSecurity', 'Link');
44
$SQL .= "INTO lkdatasetgroup ";
46
$SQL .= " DataSetID, ";
54
$SQL .= sprintf(" %d, %d, %d, %d, %d ", $dataSetId, $groupId, $view, $edit, $del);
57
if (!$db->query($SQL))
59
trigger_error($db->error());
60
$this->SetError(25024, __('Could not Link DataSet to Group'));
65
Debug::LogEntry($db, 'audit', 'OUT', 'DataSetGroupSecurity', 'Link');
71
* Links everyone to the layout specified
72
* @param <type> $layoutId
78
public function LinkEveryone($dataSetId, $view, $edit, $del)
82
Debug::LogEntry($db, 'audit', 'IN', 'DataSetGroupSecurity', 'LinkEveryone');
84
$groupId = $db->GetSingleValue("SELECT GroupID FROM `group` WHERE IsEveryone = 1", 'GroupID', _INT);
86
return $this->Link($dataSetId, $groupId, $view, $edit, $del);
90
* Unlinks a display group from a group
92
* @param $displayGroupID Object
93
* @param $groupID Object
95
public function Unlink($dataSetId, $groupId)
99
Debug::LogEntry($db, 'audit', 'IN', 'DataSetGroupSecurity', 'Unlink');
102
$SQL .= "DELETE FROM ";
103
$SQL .= " lkdatasetgroup ";
104
$SQL .= sprintf(" WHERE DataSetID = %d AND GroupID = %d ", $dataSetId, $groupId);
106
if (!$db->query($SQL))
108
trigger_error($db->error());
109
$this->SetError(25025, __('Could not Unlink DataSet from Group'));
114
Debug::LogEntry($db, 'audit', 'OUT', 'DataSetGroupSecurity', 'Unlink');
120
* Unlinks a display group from a group
122
* @param $displayGroupID Object
123
* @param $groupID Object
125
public function UnlinkAll($dataSetId)
129
Debug::LogEntry($db, 'audit', 'IN', 'DataSetGroupSecurity', 'Unlink');
132
$SQL .= "DELETE FROM ";
133
$SQL .= " lkdatasetgroup ";
134
$SQL .= sprintf(" WHERE DataSetID = %d ", $dataSetId);
136
if (!$db->query($SQL))
138
trigger_error($db->error());
139
$this->SetError(25025, __('Could not Unlink DataSet from Group'));
144
Debug::LogEntry($db, 'audit', 'OUT', 'DataSetGroupSecurity', 'Unlink');
b'\\ No newline at end of file'