Skip to content
Snippets Groups Projects
Commit 707a1fc5 authored by Johannes Goderbauer's avatar Johannes Goderbauer Committed by Johannes Goderbauer
Browse files

Employee_entity: grantDelete

(cherry picked from commit e4e1e42c)
parent b5a23dfd
No related branches found
No related tags found
No related merge requests found
......@@ -2,5 +2,16 @@ import("Employee_lib");
import("Document_lib");
import("system.vars");
import("system.result");
// TODO: Commented because of performance problems: in Filter view this Process is called for every row. Waiting for bugfix
//result.string(!DocumentUtil.hasDocuments("EMPLOYEE", null, EmployeeUtils.sliceUserId(vars.get("$field.UID"))));
\ No newline at end of file
var res = false;
//the current user should not delete himself
if (EmployeeUtils.getCurrentUserName() != vars.get("$field.TITLE")
&& !EmployeeUtils.hasRelations(vars.get("$field.CONTACT_ID"))
&& !DocumentUtil.hasDocuments("EMPLOYEE", null, EmployeeUtils.sliceUserId(vars.get("$field.UID")))
)
{
res = true;
}
result.string(res);
\ No newline at end of file
......@@ -3,6 +3,6 @@ import("system.vars");
import("system.tools");
import("Employee_lib");
//TODO: the current user should not delete himself, put this condition in grantDelete when available
//the current user should not delete himself
if (EmployeeUtils.getCurrentUserName() != vars.get("$field.TITLE") && !EmployeeUtils.hasRelations(vars.get("$field.CONTACT_ID")))
tools.deleteUser(vars.get("$field.TITLE"));
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment