/**
  * @param string $rule
  * @param int    $objectId
  * @param array  $dynamicAttributes
  *
  * @throws \Wonderland\Library\Exception\AccessDeniedException
  * @throws ForbiddenException
  */
 public function checkAccess($rule, $objectId = null, $dynamicAttributes = [])
 {
     if (($user = $this->getUser()) === null) {
         throw new AccessDeniedException();
     }
     if (($check = $this->application->get('abac')->enforce($rule, $user->getId(), $objectId, $dynamicAttributes)) !== true) {
         throw new ForbiddenException($check);
     }
 }
Ejemplo n.º 2
0
 /**
  * @param int $id
  * @return int
  */
 public function deleteTask($id)
 {
     $db = $this->application->get('database_connection');
     $db->query("DELETE FROM tasks WHERE IDTask = {$id}");
     return $db->affected_rows;
 }