Commit 98fab84400ef7cb8090329d00244064e59bbd047
1 parent
cb945646
Moved commonly used permission checking functions in lib/security/permission.inc
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@161 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
1 additions
and
76 deletions
lib/documentmanagement/documentModify.inc
| @@ -88,83 +88,8 @@ class DocumentModify { | @@ -88,83 +88,8 @@ class DocumentModify { | ||
| 88 | 88 | ||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | - /** | ||
| 92 | - * Checks if the current user has write permission for a specific folder | ||
| 93 | - * | ||
| 94 | - * @param $iFolderID Primary key of folder to check | ||
| 95 | - * | ||
| 96 | - * @return true is the user has folder write permission, false otherwise and set $_SESSION["errorMessage"] | ||
| 97 | - */ | ||
| 98 | - function hasFolderWritePermission($iFolderID) { | ||
| 99 | - | ||
| 100 | - return true; | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - /** | ||
| 104 | - * Check is the user is assigned a specific role that has write permission for a folder | ||
| 105 | - * | ||
| 106 | - * @param $iFolderID Primary key of folder to check | ||
| 107 | - * | ||
| 108 | - * @return true is the user has the role assigned, false otherwise and set $_SESSION["errorMessage"] | ||
| 109 | - */ | ||
| 110 | - function hasWriteRoleForFolder($iFolderID) { | ||
| 111 | - global $default; | ||
| 112 | - $sql = new Owl_DB(); | ||
| 113 | - $sql->query("SELECT * FROM " . $default->owl_folders_user_links_table . " AS FURL INNER JOIN " . $default->owl_role_table . " AS R ON FURL.role_id = R.id WHERE folder_id = " . $iFolderID . " AND user_id = " . $_SESSION["user_id"] . " AND R.can_write = 1"); | ||
| 114 | - if ($sql->next_record()) { | ||
| 115 | - return true; | ||
| 116 | - } | ||
| 117 | - $_SESSION["errorMessage"] = $lang_err_user_role; | ||
| 118 | - return false; | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - /** | ||
| 122 | - * Checks if the current user is in a given role | ||
| 123 | - * | ||
| 124 | - * @param $sRoleName Name of role to check | ||
| 125 | - * | ||
| 126 | - * @return true if the user is in the role, false otherwise and sets $_SESSION["errorMessage"] | ||
| 127 | - */ | ||
| 128 | - function isInGroup($sGroupName) { | ||
| 129 | - return true; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - /** | ||
| 133 | - * Get the primary key for a role | ||
| 134 | - * | ||
| 135 | - * @param $sRoleName Name of role to get primary key for | ||
| 136 | - * | ||
| 137 | - * @return ID if role exists, false otherwise and set $_SESSION["errorMessage"] | ||
| 138 | - */ | ||
| 139 | - function getRoleID($sRoleName) { | ||
| 140 | - global $default, $lang_database_error; | ||
| 141 | - if (roleExists($sRoleName) { | ||
| 142 | - $sql = new Owl_DB(); | ||
| 143 | - $sql->query("SELECT id FROM " . $default->owl_role_table . " WHERE name = '" . $sRoleName . "'"; | ||
| 144 | - sql->next_record(); | ||
| 145 | - return sql->f("id"); | ||
| 146 | - } | ||
| 147 | - $_SESSION["errorMessage"] = $lang_database_error; | ||
| 148 | - return false; | ||
| 149 | - } | ||
| 150 | 91 | ||
| 151 | - /** | ||
| 152 | - * Checks if a given role exists | ||
| 153 | - * | ||
| 154 | - * @param $sRoleName Role to check for | ||
| 155 | - * | ||
| 156 | - * @return true if role exists, false otherwise and set $_SESSION["errorMessage"] | ||
| 157 | - */ | ||
| 158 | - function roleExists($sRoleName) { | ||
| 159 | - global $default; | ||
| 160 | - $sql = new Owl_DB(); | ||
| 161 | - $sql->query("SELECT id FROM " . $default->owl_role_table . " WHERE name = '" . $sRoleName . "'"; | ||
| 162 | - if (sql->next_record()) { | ||
| 163 | - return true; | ||
| 164 | - } | ||
| 165 | - $_SESSION["errorMessage"] = $lang_err_role_not_exist . $sRoleName; | ||
| 166 | - return false; | ||
| 167 | - } | 92 | + |
| 168 | 93 | ||
| 169 | } | 94 | } |
| 170 | 95 |