diff options
author | mconway <michael.c.conway@gmail.com> | 2013-02-04 17:03:11 (GMT) |
---|---|---|
committer | mconway <michael.c.conway@gmail.com> | 2013-02-04 17:03:11 (GMT) |
commit | 598f05b8c42301a40beea7d9def478c691698ceb (patch) | |
tree | 097ac852b5f1e79a663283063cc4b6328d2a9a94 | |
parent | e67064b6207efb50d6a4727c1f5a12226fb082de (diff) | |
download | QCG-Data-598f05b8c42301a40beea7d9def478c691698ceb.zip QCG-Data-598f05b8c42301a40beea7d9def478c691698ceb.tar.gz QCG-Data-598f05b8c42301a40beea7d9def478c691698ceb.tar.bz2 |
[#1181] fix memory in idrop web2 when changing login
9 files changed, 113 insertions, 12 deletions
diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy index 2928733..8a01a42 100755 --- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy +++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/LoginController.groovy @@ -6,11 +6,13 @@ import org.irods.jargon.core.exception.JargonException import org.irods.jargon.core.pub.IRODSAccessObjectFactory import org.irods.jargon.core.pub.ResourceAO import org.irods.jargon.core.pub.UserAO +import org.irods.mydrop.service.ViewStateService class LoginController { IRODSAccessObjectFactory irodsAccessObjectFactory IRODSAccount irodsAccount + ViewStateService viewStateService //static allowedMethods = [authenticate:'POST'] @@ -68,7 +70,7 @@ class LoginController { log.info("preset auth scheme is:${presetAuthScheme}") loginCommand.authMethod = presetAuthScheme } - + render(view:"login", model:[loginCommand:loginCommand]) } @@ -150,6 +152,7 @@ class LoginController { AuthResponse authResponse try { authResponse = irodsAccessObjectFactory.authenticateIRODSAccount(irodsAccount) + viewStateService.clearViewState() } catch (JargonException e) { log.error("unable to authenticate, JargonException", e) diff --git a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SharingController.groovy b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SharingController.groovy index 720d4b8..b8773ed 100755 --- a/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SharingController.groovy +++ b/idrop-web/grails-app/controllers/org/irods/mydrop/controller/SharingController.groovy @@ -42,6 +42,34 @@ class SharingController { log.debug("closing the session") irodsAccessObjectFactory.closeSession() } + + def getSharingDialogInfo = { + def absPath = params['absPath'] + if (absPath == null) { + log.error "no absPath in request for showAclDetails()" + def message = message(code:"error.no.path.provided") + response.sendError(500,message) + } + + log.info("showAclDetails for absPath: ${absPath}") + + + boolean sharing = sharingService.isSharingSupported(irodsAccount) + log.info("sharing supported:${sharing}") + + IRODSSharedFileOrCollection irodsSharedFileOrCollection + if (sharing) { + try { + irodsSharedFileOrCollection = sharingService.findShareForPath(absPath, irodsAccount) + } catch (JargonException je) { + log.warn("sharing does not seem to be supported, probably due to specific query not supported, treat as if sharing is off", je) + } + } + + render(view:"sharingPanelWrapper",model:[absPath:absPath, irodsSharedFileOrCollection:irodsSharedFileOrCollection]) + + + } /** * Load the acl details area, this will show the main form, and subsequently, the table will be loaded via AJAX @@ -238,9 +266,17 @@ class SharingController { return } - log.info("adding share:${shareName}") - IRODSSharedFileOrCollection irodsSharedFileOrCollection = sharingService.createShare(absPath, shareName, irodsAccount) - log.info("rendering new share:${irodsSharedFileOrCollection}") + IRODSSharedFileOrCollection irodsSharedFileOrCollection + if (action == "add") { + log.info("adding share:${shareName}") + irodsSharedFileOrCollection = sharingService.createShare(absPath, shareName, irodsAccount) + log.info("rendering new share:${irodsSharedFileOrCollection}") + + } else { + irodsSharedFileOrCollection = sharingService.updateShare(absPath, shareName, irodsAccount) + log.info("updated share to:${irodsSharedFileOrCollection}") + } + flash.message = message(code:"message.share.update.successful") render(view:"sharingPanelWrapper", model:[absPath:absPath, irodsSharedFileOrCollection:irodsSharedFileOrCollection, action:action]) diff --git a/idrop-web/grails-app/services/org/irods/mydrop/service/SharingService.groovy b/idrop-web/grails-app/services/org/irods/mydrop/service/SharingService.groovy index b59ebb4..b964ab3 100644 --- a/idrop-web/grails-app/services/org/irods/mydrop/service/SharingService.groovy +++ b/idrop-web/grails-app/services/org/irods/mydrop/service/SharingService.groovy @@ -123,7 +123,31 @@ class SharingService { irodsSharingService.createShare(irodsAbsolutePath, shareName); return irodsSharingService.findShareByAbsolutePath(irodsAbsolutePath) } + + /** + * Update the given share to the new share name + * @param irodsAbsolutePath + * @param newShareName + * @param irodsAccount + * @return + * @throws JargonException + */ + IRODSSharedFileOrCollection updateShare(String irodsAbsolutePath, String newShareName, IRODSAccount irodsAccount) throws JargonException { + if (irodsAbsolutePath == null || irodsAbsolutePath.isEmpty()) { + throw new IllegalArgumentException("null or empty irodsAbsolutePath") + } + + if (newShareName == null || newShareName.isEmpty()) { + throw new IllegalArgumentException("null or empty newShareName") + } - + if (irodsAccount == null) { + throw new IllegalArgumentException("null irodsAccount"); + } + + IRODSSharingService irodsSharingService = new IRODSSharingServiceImpl(irodsAccessObjectFactory, irodsAccount) + irodsSharingService.updateShareName(irodsAbsolutePath, newShareName) + return irodsSharingService.findShareByAbsolutePath(irodsAbsolutePath) + } } diff --git a/idrop-web/grails-app/services/org/irods/mydrop/service/ViewStateService.groovy b/idrop-web/grails-app/services/org/irods/mydrop/service/ViewStateService.groovy index db3097b..baabfcb 100644 --- a/idrop-web/grails-app/services/org/irods/mydrop/service/ViewStateService.groovy +++ b/idrop-web/grails-app/services/org/irods/mydrop/service/ViewStateService.groovy @@ -20,6 +20,15 @@ class ViewStateService { } /** + * clear the view state + + */ + public void clearViewState() { + getSession().viewState = null + + } + + /** * Store the root Path * @param path * @return diff --git a/idrop-web/grails-app/views/sharing/_sharingPanel.gsp b/idrop-web/grails-app/views/sharing/_sharingPanel.gsp index 046d1d3..6a3a4e5 100644 --- a/idrop-web/grails-app/views/sharing/_sharingPanel.gsp +++ b/idrop-web/grails-app/views/sharing/_sharingPanel.gsp @@ -6,7 +6,7 @@ <div> <h4>This file is marked as a share, and appears with the name: - ${irodsSharedFileOrCollection.shareName} for users with access rights</h4> + <strong>${irodsSharedFileOrCollection.shareName}</strong> for users with access rights</h4> </div> </g:if> @@ -24,6 +24,8 @@ </g:if> <g:if test="${grailsApplication.config.idrop.config.use.sharing==true && irodsSharedFileOrCollection == null}"> + <h4>This file is not currently marked as a share. Marking as a share will allow users with access rights to see this collection as shared with them</h4> + <button onclick="addShareAtPath()"> <g:message code="text.add.share" /> </button> diff --git a/idrop-web/grails-app/views/sharing/addShareDialog.gsp b/idrop-web/grails-app/views/sharing/addShareDialog.gsp index 08ee36f..5527afc 100755 --- a/idrop-web/grails-app/views/sharing/addShareDialog.gsp +++ b/idrop-web/grails-app/views/sharing/addShareDialog.gsp @@ -30,7 +30,7 @@ <button type="button" class="btn" id="btnUpdateNamedShare" onclick="updateNamedShare()"> <g:message code="text.update" /> </button> - <button type="cancel" class="btn"> + <button type="button" class="btn" onclick="closeNamedShareDialog()"> <g:message code="text.cancel" /> </button> </div> diff --git a/idrop-web/release_notes.txt b/idrop-web/release_notes.txt index 9f32b86..8642638 100755 --- a/idrop-web/release_notes.txt +++ b/idrop-web/release_notes.txt @@ -19,11 +19,10 @@ Note that the following bug and feature requests are logged in GForge with relat ==Bug Fixes== +* [#1181] fix memory in idrop web2 when changing login ==Features== *[#984] iDrop web '2.0' redesign effort - - *[#78] very large collection paging
\ No newline at end of file diff --git a/idrop-web/web-app/js/bundles/messages.properties b/idrop-web/web-app/js/bundles/messages.properties index 5385a0a..0dec68b 100755 --- a/idrop-web/web-app/js/bundles/messages.properties +++ b/idrop-web/web-app/js/bundles/messages.properties @@ -6,6 +6,7 @@ msg_delete_selected_file=Delete selected file? msg_file_deleted=File deleted msg_file_starred=File starred msg_file_unstarred=File unstarred +msg_action_missing = No action provided msg.path.missing = No file selected msg_password_no_data = No password data found msg_password_successful = Password change successful diff --git a/idrop-web/web-app/js/mydrop/home.js b/idrop-web/web-app/js/mydrop/home.js index 2c6b45e..00e222c 100755 --- a/idrop-web/web-app/js/mydrop/home.js +++ b/idrop-web/web-app/js/mydrop/home.js @@ -2600,7 +2600,6 @@ function addShareAtPath() { return false; } - // show the public link dialog var url = "/sharing/prepareAddShareDialog"; var params = { absPath : path @@ -2622,7 +2621,6 @@ function editShareAtPath() { return false; } - // show the public link dialog var url = "/sharing/prepareEditShareDialog"; var params = { absPath : path @@ -2648,16 +2646,26 @@ function fillInShareDialog(data) { function updateNamedShare() { var path = $("#aclDetailsAbsPath").val(); var shareName = $("#shareName").val(); + var action = $("#action").val(); showBlockingPanel(); + if (path == null) { setMessage(jQuery.i18n.prop('msg.path.missing')); unblockPanel(); return false; } + if (action == null) { + setErrorMessage(jQuery.i18n.prop('msg.action.missing')); + unblockPanel(); + return false; + } + + var params = { absPath : path, - shareName: shareName + shareName: shareName, + action : action } var jqxhr = $.post(context + "/sharing/processUpdateShareDialog", params, @@ -2679,6 +2687,25 @@ function updateNamedShare() { } /** + * Close the add/update share dialog by reloading the share info + */ +function closeNamedShareDialog() { + + var path = selectedPath; + if (selectedPath == null) { + return false; + } + + var url = "/sharing/getSharingDialogInfo"; + var params = { + absPath : path + } + + lcSendValueWithParamsAndPlugHtmlInDiv(url, params, "#sharingPanelContainingDiv", null); + +} + +/** * Close the add/update share dialog */ function closeShareDialog() { |