From cc1cccf1a225197afda08eadb671cae1a981488e Mon Sep 17 00:00:00 2001 From: hzzz Date: Fri, 15 Jun 2018 21:49:38 +0800 Subject: [PATCH] auth --- .../com/fr/design/env/RemoteWorkspace.java | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/designer-base/src/com/fr/design/env/RemoteWorkspace.java b/designer-base/src/com/fr/design/env/RemoteWorkspace.java index 33bb1b4bca..fa732cb10b 100644 --- a/designer-base/src/com/fr/design/env/RemoteWorkspace.java +++ b/designer-base/src/com/fr/design/env/RemoteWorkspace.java @@ -1,62 +1,73 @@ package com.fr.design.env; import com.fr.general.Inter; +import com.fr.report.util.RemoteDesignAuthenticateUtils; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceClient; import com.fr.workspace.connect.WorkspaceConnection; +import com.fr.workspace.engine.WorkspaceServerContext; /** * Created by juhaoyu on 2018/6/14. * 远程工作目录 */ public class RemoteWorkspace implements Workspace { - + private final WorkspaceClient client; - + private final String address; - + private final String userName; - + RemoteWorkspace(WorkspaceClient client, WorkspaceConnection connection) { - + this.client = client; this.address = connection.getIp() + ":" + connection.getPort(); this.userName = connection.getUserName(); } - + @Override public String getName() { - + return userName; } - + @Override public String getPath() { - + return address; } - + @Override public String getDescription() { - + return userName + "@" + "[" + Inter.getLocText("Fine-Designer_Basic_Remote_Env") + "]"; } - + @Override public boolean isWarDeploy() { - + return false; } - + @Override public boolean isLocal() { - + return false; } - + + @Override + public boolean isRoot() { + try { + return RemoteDesignAuthenticateUtils.isRoot(WorkspaceServerContext.currentUsername()); + } catch (Exception e) { + return false; + } + } + @Override public T get(Class type) { - + return client.getPool().get(type); } }