Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnworth committed Sep 18, 2013
2 parents 3df0591 + 7e6b43f commit 0458807
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
55 changes: 28 additions & 27 deletions src/donkey/services/fileio/actions.clj
Expand Up @@ -77,33 +77,34 @@
(string/join "." (drop-last (string/split (ft/basename tmp-path) #"\."))))

(defn upload
[user tmp-path final-path]
(log/info "In upload for " user tmp-path final-path)
(with-jargon (jargon-cfg) [cm]
(when-not (user-exists? cm user)
(throw+ {:error_code ERR_NOT_A_USER
:user user}))

(when-not (exists? cm final-path)
(throw+ {:error_code ERR_DOES_NOT_EXIST
:id final-path}))

(when-not (is-writeable? cm user final-path)
(throw+ {:error_code ERR_NOT_WRITEABLE
:id final-path}))

(let [new-fname (new-filename tmp-path)
new-path (ft/path-join final-path new-fname)]
(if (exists? cm new-path) (delete cm new-path))
(move cm tmp-path new-path :user user :admin-users (irods-admins) :skip-source-perms? true)
(set-owner cm new-path user)
{:file
{:id new-path
:label (ft/basename new-path)
:permissions (dataobject-perm-map cm user new-path)
:date-created (created-date cm new-path)
:date-modified (lastmod-date cm new-path)
:file-size (str (file-size cm new-path))}})))
[user tmp-path fpath]
(log/info "In upload for " user tmp-path fpath)
(let [final-path (ft/rm-last-slash fpath)]
(with-jargon (jargon-cfg) [cm]
(when-not (user-exists? cm user)
(throw+ {:error_code ERR_NOT_A_USER
:user user}))

(when-not (exists? cm final-path)
(throw+ {:error_code ERR_DOES_NOT_EXIST
:id final-path}))

(when-not (is-writeable? cm user final-path)
(throw+ {:error_code ERR_NOT_WRITEABLE
:id final-path}))

(let [new-fname (new-filename tmp-path)
new-path (ft/path-join final-path new-fname)]
(if (exists? cm new-path) (delete cm new-path))
(move cm tmp-path new-path :user user :admin-users (irods-admins) :skip-source-perms? true)
(set-owner cm new-path user)
{:file
{:id new-path
:label (ft/basename new-path)
:permissions (dataobject-perm-map cm user new-path)
:date-created (created-date cm new-path)
:date-modified (lastmod-date cm new-path)
:file-size (str (file-size cm new-path))}}))))

(defn url-encoded?
[string-to-check]
Expand Down
7 changes: 4 additions & 3 deletions src/donkey/services/metadata/apps.clj
Expand Up @@ -5,8 +5,9 @@
[donkey.util.service :as service]
[mescal.de :as agave]))

(def ^:private uuid-regex
#"^\p{XDigit}{8}(?:-\p{XDigit}{4}){3}-\p{XDigit}{12}$")
(def ^:private uuid-regexes
[#"^\p{XDigit}{8}(?:-\p{XDigit}{4}){3}-\p{XDigit}{12}$"
#"^[at]\p{XDigit}{32}"])

(defprotocol AppLister
"Used to list apps available to the Discovery Environment."
Expand All @@ -33,7 +34,7 @@
(.listPublicApps agave-client)
(metadactyl/apps-in-group group-id)))
(getApp [this app-id]
(if (re-find uuid-regex app-id)
(if (some #(re-find % app-id) uuid-regexes)
(metadactyl/get-app app-id)
(.getApp agave-client app-id))))

Expand Down

0 comments on commit 0458807

Please sign in to comment.