示例#1
0
 public static function getOrCreate(Group $g)
 {
     $db = Loader::db();
     $petID = $db->GetOne('select petID from PermissionAccessEntityTypes where petHandle = \'group\'');
     $peID = $db->GetOne('select pae.peID from PermissionAccessEntities pae inner join PermissionAccessEntityGroups paeg on pae.peID = paeg.peID where petID = ? and paeg.gID = ?', array($petID, $g->getGroupID()));
     if (!$peID) {
         $db->Execute("insert into PermissionAccessEntities (petID) values(?)", array($petID));
         $peID = $db->Insert_ID();
         Config::save('concrete.misc.access_entity_updated', time());
         $db->Execute('insert into PermissionAccessEntityGroups (peID, gID) values (?, ?)', array($peID, $g->getGroupID()));
     }
     return \Concrete\Core\Permission\Access\Entity\Entity::getByID($peID);
 }
示例#2
0
 public function setTreeNodeGroup(UserGroup $g)
 {
     $db = Loader::db();
     $db->Replace('TreeGroupNodes', array('treeNodeID' => $this->getTreeNodeID(), 'gID' => $g->getGroupID()), array('treeNodeID'), true);
     $this->gID = $g->getGroupID();
 }
示例#3
0
 public function removeGroup(Group $g)
 {
     $db = Loader::db();
     $db->Execute('delete from GroupSetGroups where gsID = ? and gID = ?', array($this->getGroupSetID(), $g->getGroupID()));
 }
示例#4
0
 /**
  * Return true if user is in Group.
  *
  * @param Group $g
  * @return bool
  */
 public function inGroup($g)
 {
     $app = Application::getFacadeApplication();
     $db = $app['database']->connection();
     $v = array($this->uID, $g->getGroupID());
     $cnt = $db->GetOne("select gID from UserGroups where uID = ? and gID = ?", $v);
     return $cnt > 0;
 }
示例#5
0
 public function getGroupID()
 {
     return parent::getGroupID();
 }