Commit e99a0bd31b3dd10b850083c645bb52ff84fdb8e4

Authored by kevin_fourie
1 parent 81633775

Merged in from STABLE trunk...

KTS-3715
"Return 'Add folder' permissions when getting a folder listing"
Fixed: added userHasAddFolderPermission function

Committed By: Martin Kirsten
Reviewed By: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.3a-Release-Branch@9354 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 15 additions and 0 deletions
lib/security/Permission.inc
@@ -121,6 +121,21 @@ class Permission { @@ -121,6 +121,21 @@ class Permission {
121 return KTPermissionUtil::userHasPermissionOnItem($oUser, 121 return KTPermissionUtil::userHasPermissionOnItem($oUser,
122 $oPermission, $oFolder); 122 $oPermission, $oFolder);
123 } 123 }
  124 +
  125 + /**
  126 + * Checks if the current user has add folder permission for a specific folder
  127 + *
  128 + * @param $oFolder Folder object to check
  129 + *
  130 + * @return boolean true if the user has add folder permission, false otherwise and set $_SESSION["errorMessage"]
  131 + */
  132 + function userHasAddFolderPermission($oFolder) {
  133 + $oUser = User::get($_SESSION["userID"]);
  134 + $oPermission = KTPermission::getByName('ktcore.permissions.addFolder');
  135 +
  136 + return KTPermissionUtil::userHasPermissionOnItem($oUser,
  137 + $oPermission, $oFolder);
  138 + }
124 139
125 /** 140 /**
126 * Check if the current user is a system administrator 141 * Check if the current user is a system administrator