You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/09/21 04:17:14 UTC

openmeetings git commit: [OPENMEETINGS-1706] copy implemented, but broken due to security restrictions

Repository: openmeetings
Updated Branches:
  refs/heads/master 83b2790a7 -> 46b7fcdaa


[OPENMEETINGS-1706] copy implemented, but broken due to security restrictions


Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/46b7fcda
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/46b7fcda
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/46b7fcda

Branch: refs/heads/master
Commit: 46b7fcdaabf66dcd35b08c5cdbc99f29f314016d
Parents: 83b2790
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Thu Sep 21 11:17:05 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Thu Sep 21 11:17:05 2017 +0700

----------------------------------------------------------------------
 .../core/remote/ScopeApplicationAdapter.java    | 37 ++++++++------------
 openmeetings-flash/src/main/flex/main.mxml      |  3 +-
 .../flex/org/apache/openmeetings/OmVideo.as     | 10 ++++--
 3 files changed, 24 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/46b7fcda/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
----------------------------------------------------------------------
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
index 203199f..2c5c127 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
@@ -815,7 +815,8 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp
 	 * it sends a general message to a specific clientId
 	 *
 	 * @param newMessage
-	 * @param clientId
+	 * @param uid
+	 * @param scope
 	 * @return 1 in case of success, -1 otherwise
 	 */
 	public int sendMessageById(Object newMessage, final String uid, IScope scope) {
@@ -825,16 +826,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp
 			Map<String, Object> hsm = new HashMap<>();
 			hsm.put("message", newMessage);
 
-			// broadcast Message to specific user with id inside the same Scope
-			for (IConnection conn : scope.getClientConnections()) {
-				if (conn != null) {
-					if (conn instanceof IServiceCapableConnection) {
-						if (uid.equals(IClientUtil.getId(conn.getClient()))) {
-							((IServiceCapableConnection) conn).invoke("sendVarsToMessageWithClient", new Object[] { hsm }, this);
-						}
-					}
-				}
-			}
+			_sendMessageToClient(uid, hsm, scope);
 		} catch (Exception err) {
 			_log.error("[sendMessageWithClient] ", err);
 			return -1;
@@ -852,18 +844,8 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp
 	public int sendMessageToClient(final String uid, Object newMessage) {
 		try {
 			IConnection current = Red5.getConnectionLocal();
-			StreamClient currentClient = sessionManager.get(IClientUtil.getId(current.getClient()));
-
-			Map<String, Object> hsm = new HashMap<>();
-			hsm.put("client", currentClient);
-			hsm.put("message", newMessage);
 
-			// broadcast Message to specific user with id inside the same Scope
-			for (IConnection conn : current.getScope().getClientConnections()) {
-				if (IClientUtil.getId(conn.getClient()).equals(uid)) {
-					((IServiceCapableConnection) conn).invoke("sendVarsToMessageWithClient", new Object[] { hsm }, this);
-				}
-			}
+			_sendMessageToClient(uid, newMessage, current.getScope());
 		} catch (Exception err) {
 			_log.error("[sendMessageToClient] ", err);
 			return -1;
@@ -871,6 +853,17 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp
 		return 1;
 	}
 
+	private void _sendMessageToClient(final String uid, Object msg, IScope scope) {
+		new MessageSender(scope, "sendVarsToMessageWithClient", msg, this) {
+
+			@Override
+			public boolean filter(IConnection conn) {
+				IClient client = conn.getClient();
+				return uid == null || !IClientUtil.getId(client).equals(uid);
+			}
+		}.start();
+	}
+
 	public boolean sendRemoteCursorEvent(final String uid, Map<String, Object> messageObj) {
 		new MessageSender("sendRemoteCursorEvent", messageObj, this) {
 

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/46b7fcda/openmeetings-flash/src/main/flex/main.mxml
----------------------------------------------------------------------
diff --git a/openmeetings-flash/src/main/flex/main.mxml b/openmeetings-flash/src/main/flex/main.mxml
index 8c5dbbe..1caa221 100644
--- a/openmeetings-flash/src/main/flex/main.mxml
+++ b/openmeetings-flash/src/main/flex/main.mxml
@@ -357,13 +357,12 @@
 		}
 
 		private function copyHandler(e:Event):void {
-			debug("copyHandler :: ", params);
 			video.getNc().call(
 				"sendRemoteCursorEvent"
 				, new Responder(function (res:Object):void {})
 				, params.uid, {
 					action: "copy"
-					, uid: params.uid
+					, uid: params.selfUid
 				});
 		}
 

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/46b7fcda/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
----------------------------------------------------------------------
diff --git a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
index ba5dc4f..741b72e 100644
--- a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
+++ b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
@@ -17,6 +17,8 @@
  * under the License.
  */
 package org.apache.openmeetings {
+import flash.desktop.Clipboard;
+import flash.desktop.ClipboardFormats;
 import flash.events.AsyncErrorEvent;
 import flash.events.NetStatusEvent;
 import flash.external.ExternalInterface;
@@ -248,7 +250,7 @@ public class OmVideo {
 				}
 			});
 			nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, function (event:AsyncErrorEvent):void {
-				debug("login Async error" + event);
+				debug("OmVideo Async error" + event);
 			});
 			nc.client = {
 				onMetaData: function (infoObject:Object):void {
@@ -274,7 +276,11 @@ public class OmVideo {
 					}
 				}
 				, sendVarsToMessageWithClient: function(obj:Object):void {
-					debug("sendVarsToMessageWithClient :: ", obj);
+					if ("copiedText" === obj[0]) {
+						debug("sendVarsToMessageWithClient :: copiedText " + obj[1]);
+						Clipboard.generalClipboard.clear();
+						Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, obj[1] as String);
+					}
 				}
 			};
 			_connect(url);