summaryrefslogtreecommitdiffstats
path: root/idrop-web/grails-app/services
diff options
context:
space:
mode:
authormconway <michael.c.conway@gmail.com>2013-01-26 14:16:20 (GMT)
committer mconway <michael.c.conway@gmail.com>2013-01-26 14:16:20 (GMT)
commit75760d046520dc34698d354c238aca52edecc88a (patch)
treef9ee38aec7cf014704e156c93379291c1bf73712 /idrop-web/grails-app/services
parent94299476fb5e49410b25c67b37b75403192d3fbf (diff)
downloadQCG-Data-75760d046520dc34698d354c238aca52edecc88a.zip
QCG-Data-75760d046520dc34698d354c238aca52edecc88a.tar.gz
QCG-Data-75760d046520dc34698d354c238aca52edecc88a.tar.bz2
[#511] addign sharing to idrop-web
Diffstat (limited to 'idrop-web/grails-app/services')
-rw-r--r--idrop-web/grails-app/services/org/irods/mydrop/service/SharingService.groovy54
1 files changed, 54 insertions, 0 deletions
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
new file mode 100644
index 0000000..17e7177
--- /dev/null
+++ b/idrop-web/grails-app/services/org/irods/mydrop/service/SharingService.groovy
@@ -0,0 +1,54 @@
+package org.irods.mydrop.service
+
+import org.irods.jargon.core.connection.IRODSAccount
+import org.irods.jargon.core.exception.JargonException
+import org.irods.jargon.core.pub.IRODSAccessObjectFactory
+import org.irods.jargon.usertagging.domain.IRODSSharedFileOrCollection
+import org.irods.jargon.usertagging.sharing.IRODSSharingService
+import org.irods.jargon.usertagging.sharing.IRODSSharingServiceImpl
+
+/**
+ * Service to manage shares, which are treated like first class objects, managing marking as a share and updating ACLs via the jargon-user-tagging
+ * share services.
+ *
+ * @author Mike Conway - DICE (www.irods.org).
+ *
+ */
+class SharingService {
+
+ static transactional = false
+ IRODSAccessObjectFactory irodsAccessObjectFactory
+
+ /**
+ * List all shares owned by the given user (Shared by me with others)
+ * @param irodsAccount
+ * @return
+ * @throws JargonException
+ */
+ List<IRODSSharedFileOrCollection> listCollectionsSharedByMe(IRODSAccount irodsAccount) throws JargonException {
+ if (irodsAccount == null) {
+ throw new IllegalArgumentException("null irodsAccount");
+ }
+
+ IRODSSharingService irodsSharingService = new IRODSSharingServiceImpl(irodsAccessObjectFactory, irodsAccount)
+ return irodsSharingService.listSharedCollectionsOwnedByAUser(irodsAccount.getUserName(), irodsAccount.getZone())
+ }
+
+ /**
+ * List all shares with the given user (shared by others with me)
+ * @param irodsAccount
+ * @return
+ * @throws JargonException
+ */
+ List<IRODSSharedFileOrCollection> listCollectionsSharedWithMe(IRODSAccount irodsAccount) throws JargonException {
+ if (irodsAccount == null) {
+ throw new IllegalArgumentException("null irodsAccount");
+ }
+
+ IRODSSharingService irodsSharingService = new IRODSSharingServiceImpl(irodsAccessObjectFactory, irodsAccount)
+ return irodsSharingService.listSharedCollectionsSharedWithUser(irodsAccount.getUserName(), irodsAccount.getZone())
+ }
+
+
+
+}