forked from UtrechtUniversity/yoda-ruleset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiiVaultTransitions.r
53 lines (47 loc) · 1.88 KB
/
iiVaultTransitions.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# \file iiVaultTransitions.r
# \brief Status transitions for folders in the vault space.
# \author Lazlo Westerhof
# \copyright Copyright (c) 2017-2019, Utrecht University. All rights reserved.
# \license GPLv3, see LICENSE.
# \brief Retrieve current vault folder status
#
# \param[in] folder Path of vault folder
# \param[out] folderStatus Current status of vault folder
#
iiVaultStatus(*folder, *vaultStatus) {
*vaultStatusKey = IIVAULTSTATUSATTRNAME;
*vaultStatus = UNPUBLISHED;
foreach(*row in SELECT META_COLL_ATTR_VALUE WHERE COLL_NAME = *folder AND META_COLL_ATTR_NAME = *vaultStatusKey) {
*vaultStatus = *row.META_COLL_ATTR_VALUE;
}
}
# \brief Retrieve actor of action on vault folder
#
# \param[in] folder Path of action vault folder
# \param[out] actionActor Actor of action on vault folder
#
iiVaultGetActionActor(*folder, *actor, *actionActor) {
# Retrieve vault folder collection id.
foreach(*row in SELECT COLL_ID WHERE COLL_NAME = *folder) {
*collId = *row.COLL_ID;
}
# Retrieve vault folder action actor.
*actionActor = "";
foreach(*row in SELECT COLL_ID, META_COLL_ATTR_VALUE WHERE META_COLL_ATTR_NAME = "org_vault_action_*collId") {
*err = errorcode(msi_json_arrayops(*row.META_COLL_ATTR_VALUE, *actionActor, "get", 2));
if (*err < 0) {
writeLine("serverLog", "iiVaultGetActionActor: org_vault_action_*collId contains invalid JSON");
} else {
writeLine("serverLog", "iiVaultGetActionActor: org_vault_action_*collId actor is *actionActor");
}
}
# Fallback actor (rodsadmin).
if (*actionActor == "") {
*actionActor = *actor;
}
}
# \brief Perform admin operations on the vault
#
iiAdminVaultActions() {
msiExecCmd("admin-vaultactions.sh", uuClientFullName, "", "", 0, *out);
}