コード例 #1
0
ファイル: Group.php プロジェクト: tekkla/core-security
 /**
  * Removes a group from DB and groups list
  *
  * @param integer $id_group
  *
  *
  * @throws DatabaseException
  */
 public function removeGroup($id_group)
 {
     try {
         $this->db->beginTransaction();
         // Delete usergroup
         $this->db->qb(['table' => 'core_groups', 'method' => 'DELETE', 'filter' => 'id_group = :id_group', 'params' => [':id_group' => $id_group]]);
         $this->db->execute();
         // Delete permissions related to this group
         $this->db->qb(['table' => 'core_permissions', 'method' => 'DELETE', 'filter' => 'id_group = :id_group', 'params' => [':id_group' => $id_group]]);
         $this->db->execute();
         // Remove group from current grouplist
         unset($this->groups[$id_group]);
         $this->db->endTransaction();
     } catch (\PDOException $e) {
         $this->db->cancelTransaction();
         throw new GroupException($e->getMessage(), $e->getCode(), $e->getPrevious());
     }
 }