/
GatheringAssignment.php
36 lines (30 loc) · 1.3 KB
/
GatheringAssignment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Concrete\Core\Permission\Assignment;
use Concrete\Core\Permission\Access\Access;
use Loader;
class GatheringAssignment extends Assignment
{
public function getPermissionAccessObject()
{
$db = Loader::db();
$r = $db->GetOne('select paID from GatheringPermissionAssignments where gaID = ? and pkID = ?', array(
$this->permissionObject->getGatheringID(), $this->pk->getPermissionKeyID(),
));
return Access::getByID($r, $this->pk);
}
public function clearPermissionAssignment()
{
$db = Loader::db();
$db->Execute('update GatheringPermissionAssignments set paID = 0 where pkID = ? and gaID = ?', array($this->pk->getPermissionKeyID(), $this->permissionObject->getGatheringID()));
}
public function assignPermissionAccess(Access $pa)
{
$db = Loader::db();
$db->Replace('GatheringPermissionAssignments', array('gaID' => $this->getPermissionObject()->getGatheringID(), 'paID' => $pa->getPermissionAccessID(), 'pkID' => $this->pk->getPermissionKeyID()), array('gaID', 'pkID'), true);
$pa->markAsInUse();
}
public function getPermissionKeyToolsURL($task = false)
{
return parent::getPermissionKeyToolsURL($task) . '&gaID=' . $this->getPermissionObject()->getGatheringID();
}
}