Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

不包含Joget管理员

Code Block
import orgjava.joget.apps.form.model.FormRowutil.Arrays;
import org.joget.apps.form.model.FormRowSet;
import org.joget.apps.form.service.FormUtil;
import org.joget.workflow.util.WorkflowUtil;

        java.util.List;

//获取HashVariable
        String hashVariable = "#form.appsph_projectsetup.permissionTableEdit[{requestParam.key}usersReagent[setup]#";

List hashVariableList =      Arrays.asList(hashVariable.split(";"));
//获取当前用户
        String currentUser = "#currentUser.username#";

       if(!currentUser.equals("") && (hashVariable.equals(currentUser ) || hashVariable.hashVariableList.contains(currentUser))){
            return true;
}

      }else{return false;}


包含Joget管理员

Code Block
import org.joget.appsworkflow.form.model.FormRow;
import org.joget.apps.form.model.FormRowSetservice.WorkflowUserManager;
import org.joget.appsworkflow.formutil.service.FormUtilWorkflowUtil;
import orgjava.joget.workflow.model.service.WorkflowUserManagerutil.Arrays;
import orgjava.joget.workflow.util.WorkflowUtilList;
		

//是管理员返回true
        boolean isAdmin = WorkflowUtil.isCurrentUserInRole(WorkflowUserManager.ROLE_ADMIN);
        if(isAdmin){
            return true;
        }

       
        //获取HashVariable
        String hashVariable = "#form.appsph_setup.permissionNewProjectusersReagent[setup]#";

List hashVariableList =     Arrays.asList(hashVariable.split(";"));
//获取当前用户
        String currentUser = "#currentUser.username#";
        if(!currentUser.equals("") && (hashVariable.equals(currentUser ) || hashVariable.hashVariableList.contains(currentUser))){
            return true;
        }

       
        return false;


基于Hash变量判断与当前用户权限

...