diff --git a/classes/Models/Services/Acls.php b/classes/Models/Services/Acls.php index 00f8e6cc43..fcbf8644e4 100644 --- a/classes/Models/Services/Acls.php +++ b/classes/Models/Services/Acls.php @@ -71,101 +71,6 @@ public static function getAcl($aclId) return null; } - /** - * Attempt to create a database representation of the provided '$acl'. Note, - * the 'aclId' property of '$acl' must not be set. If it is then an - * exception will be thrown. - * - * @param Acl $acl that will be created - * @return Acl with the $aclId populated. - * @throws Exception if the provided acls aclId is not null - */ - public static function createAcl(Acl $acl) - { - if (null != $acl->getAclId()) { - throw new Exception('acl must not have been saved.'); - } - - $db = DB::factory('database'); - - $query = <<insert($query, array( - ':module_id' => $acl->getModuleId(), - ':acl_type_id' => $acl->getAclTypeId(), - ':name' => $acl->getName(), - ':display' => $acl->getDisplay(), - ':enabled' => $acl->getEnabled() - )); - - $acl->setAclId($aclId); - - return $acl; - } - - /** - * Attempt to update the database representation of the provided '$acl' such - * that the information in the database corresponds to the data in the - * object provided. - * - * @param Acl $acl to be used when updating the database table. - * @return bool true iff the number of rows updated equals 1. - * @throws Exception if the provided acl's aclId is null - */ - public static function updateAcl(Acl $acl) - { - if (null == $acl->getAclId()) { - throw new Exception('Acl must have an id to be updated.'); - } - - $db = DB::factory('database'); - - $query = <<execute($query, array( - ':module_id' => $acl->getModuleId(), - ':acl_type_id' => $acl->getAclTypeId(), - ':name' => $acl->getName(), - ':display' => $acl->getDisplay(), - ':enabled' => $acl->getEnabled() - )); - - return $rows === 1; - } - - /** - * Attempt to delete the acl identified by the provided '$aclId'. - * - * @param Acl $acl - * @return bool true iff the number of rows deleted = 1. - * @throws Exception if the provided acls aclId is null - */ - public static function deleteAcl(Acl $acl) - { - if (null == $acl->getAclId()) { - throw new Exception('Acl must have an id to be deleted.'); - } - - $db = DB::factory('database'); - - $query = "DELETE FROM acls WHERE acl_id = :acl_id"; - $rows = $db->execute($query, array( - ':acl_id' => $acl->getAclId() - )); - return $rows === 1; - } - /** * Retrieve a list of a user's current acls. * @@ -199,171 +104,6 @@ public static function listUserAcls(XDUser $user) return $db->query($sql, array('user_id' => $userId)); } - /** - * Attempt to relate the provided XDUser to the Acl identified by the $aclId. - * - * @param XDUser $user the user that should have the Acl identified by the - * provided $aclId related to it. - * @param integer $aclId the unique numeric identifier for the Acl to be - * added to the provided user. - * - * @return bool true if the insert was successful else false - * - * @throws Exception if the user's userId is null - * @throws Exception if the aclId is null - */ - public static function addUserAcl(XDUser $user, $aclId) - { - if (null == $user->getUserID()) { - throw new Exception('A valid user id must be provided.'); - } - - if (null === $aclId) { - throw new Exception('A valid acl id must be provided.'); - } - $db = DB::factory('database'); - $params = array( - ':user_id' => $user->getUserId(), - ':acl_id' => $aclId - ); - $query = <<execute($query, $params); - - return $rows === 1; - } - - /** - * Attempt to remove the relation between the provided user and acl. - * - * @param XDUser $user the user that will have their relation to acl - * removed. - * @param integer $aclId the unique identifier for the acl that will be removed - * from the provided user. - * - * @return boolean true if 1 or less rows were deleted as a result of this - * action. - * - * @throws Exception if the user's userId is null - * @throws Exception if the aclId is null - **/ - public static function deleteUserAcl(XDUser $user, $aclId) - { - if (null == $user->getUserID()) { - throw new Exception('A valid user id must be provided.'); - } - if (null === $aclId) { - throw new Exception('A valid acl id must be provided.'); - } - - $db = DB::factory('database'); - - $query = "DELETE FROM user_acls WHERE user_id = :user_id AND acl_id = :acl_id"; - $rows = $db->execute($query, array( - ':user_id' => $user->getUserId(), - ':acl_id' => $aclId - )); - return $rows <= 1; - } - - /** - * Attempt to determine if the provided user has a relation to the acl - * identified by the provided aclId. - * - * @param XDUser $user the user checked for a relation to aclId - * @param integer $aclId the id of the acl checked for a relation to user - * - * @return boolean true if there is one or more results returned - * - * @throws Exception if the users userId is null - * @throws Exception if the aclId provided is null - */ - public static function userHasAcl(XDUser $user, $aclId) - { - if (null == $user->getUserID()) { - throw new Exception('A valid user id must be provided.'); - } - - if (null === $aclId) { - throw new Exception('A valid acl id must be provided.'); - } - $db = DB::factory('database'); - - $userId = $user->getUserID(); - - $sql = <<query($sql, array('acl_id' => $aclId, 'user_id' => $userId)); - - return count($results) > 0; - } - - - /** - * Similar to userHasAcl but instead of checking if the user has a relation - * to a single acl, we instead check if they have a relation to each acl - * provided in the array acls. - * - * @param XDUser $user the user being interrogated for relations to the - * provided acls - * @param array $acls the array of acls being checked for a relation to - * user - * - * @return boolean true if the user has all of the provided acls - * - * @throws Exception if the provided user's userId is null - **/ - public static function userHasAcls(XDUser $user, array $acls) - { - if (null === $user->getUserID()) { - throw new Exception('A valid user id must be provided.'); - } - $db = DB::factory('database'); - if (count($acls) < 1) { - return false; - } - - $handle = $db->handle(); - $userId = $user->getUserID(); - $aclIds = array_reduce($acls, function ($carry, Acl $item) use ($handle) { - $carry [] = $handle->quote($item->getAclId(), PDO::PARAM_INT); - }, array()); - - $sql = <<query($sql, array('user_id' => $userId, 'acl_ids' => $aclIds)); - - return count($results) > 0; - } - /** * Attempt to retrieve an array that will be used by the front end to disable particular * menu options on a user by user basis. diff --git a/classes/XDReportManager.php b/classes/XDReportManager.php index aa037fa91c..9d609ff08e 100644 --- a/classes/XDReportManager.php +++ b/classes/XDReportManager.php @@ -880,46 +880,6 @@ public function getReportUserName($report_id) return $results[0]['first_name'] . " " . $results[0]['last_name']; } - public function getReportUserFirstName($report_id) - { - $results = $this->_pdo->query( - " - SELECT u.first_name - FROM Users AS u, - Reports AS r - WHERE r.user_id = :user_id - AND r.report_id = :report_id - AND r.user_id = u.id - ", - array( - 'user_id' => $this->_user_id, - 'report_id' => $report_id, - ) - ); - - return $results[0]['first_name']; - } - - public function getReportUserLastName($report_id) - { - $results = $this->_pdo->query( - " - SELECT u.last_name - FROM Users AS u, - Reports AS r - WHERE r.user_id = :user_id - AND r.report_id = :report_id - AND r.user_id = u.id - ", - array( - 'user_id' => $this->_user_id, - 'report_id' => $report_id, - ) - ); - - return $results[0]['last_name']; - } - public function getReportUserEmailAddress($report_id) { $results = $this->_pdo->query( diff --git a/html/internal_dashboard/index.php b/html/internal_dashboard/index.php index f287cc199e..b446a9fcf6 100644 --- a/html/internal_dashboard/index.php +++ b/html/internal_dashboard/index.php @@ -199,26 +199,6 @@ function (&$v) { - - - - - Ext.onReady(function () { - new XDMoD.AppKernel.InstanceWindow({instanceId:$instance_id}).show(); -}, window, true); - -END; - } - } - ?> -