CC-2126: User should not be delete himself

Done.
This commit is contained in:
James Moon 2011-05-05 15:38:33 -07:00 committed by mkonecny
parent b9c1f7356f
commit 2a5df8bed9
2 changed files with 24 additions and 2 deletions

View file

@ -159,7 +159,25 @@ class User {
public static function getUsersDataTablesInfo($datatables_post) {
$fromTable = "cc_subjs";
return StoredFile::searchFiles($fromTable, $datatables_post);
// get current user
$username = "";
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$username = $auth->getIdentity()->login;
}
$res = StoredFile::searchFiles($fromTable, $datatables_post);
// mark record which is for the current user
foreach($res['aaData'] as &$record){
if($record[1] == $username){
$record[5] = "self";
}
}
return $res;
}
public static function getUserData($id){