PermissionDecider.inc 605 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. class PermissionDecider {
  3. public function hasTopicAccess($topicId) {
  4. $topicAccess = false;
  5. $session = new Session();
  6. $userId = $session->getValue("logged_in");
  7. if ($userId) {
  8. $sql = sprintf("SELECT *
  9. FROM user_topic_acl
  10. WHERE user_id = '%s'
  11. AND topic_id = '%s'
  12. AND (rank_id = 1 OR rank_id = 2 OR rank_id = 3)", $userId, $topicId);
  13. $database = new Database();
  14. $permissionResults = $database->query($sql);
  15. if (count($permissionResults) > 0) {
  16. $topicAccess = true;
  17. }
  18. }
  19. return $topicAccess;
  20. }
  21. public function getRankForTopic($topicId) {
  22. }
  23. }