If you are reading this, you are likely wanting a well documented published API to reference. You won't find that here. Its our opinion that the admin WebInterface provides a working example that is easily watched to see the commands its issuing for the documentation. If you want to know how to make a user using a web call, enable the network monitoring in Chrome/Safari/FireFox/Edge and make a user. Then its all detailed out in the network requests created.
Here are a few examples here to get you started though, and we may add to this list in the future too.
(The attachments tab at the top contains the sample files.)
Making a new User with VFS#
Builds a brand new user, or replaces an existing one entirely.
curl -d command=setUserItem -d data_action=replace -d xmlItem=user -d serverGroup=MainUsers -d username=curl_user --data-urlencode user@user.xml --data-urlencode vfs_items@vfs_items.xml --data-urlencode permissions@permissions.xml http://crushadmin:pass@127.0.0.1:8080/(long line, so get it all)
Updating a user#
Fills in the missing properties, doesn't alter the VFS. The VFS is an all or nothing approach. The above we did all, this one we are doing nothing. The password is always required, and in this case we are just updating the user with the items in the user.xml, but not replacing items that the user already has.
curl -d command=setUserItem -d data_action=update -d xmlItem=user -d serverGroup=MainUsers -d username=curl_user --data-urlencode user@user.xml http://crushadmin:pass@127.0.0.1:8080/(long line, so get it all)
Update/add to VFS of a user
#
This will update the VFS, either replacing an existing item, or adding a new item if it doesn't exist:curl -d command=setUserItem -d data_action=update_vfs -d xmlItem=user -d serverGroup=MainUsers -d username=user1 -d vfs_items@vfs_items.XML -d permissions@permissions.XML -u crushadmin:passw http://127.0.0.1:8080/(long line, so get it all)
Delete VFS item from a user
#
This will remove a VFS item (so don't pass in a full permissions or vfs_items object or you would remove everything):curl -d command=setUserItem -d data_action=update_vfs_remove -d xmlItem=user -d serverGroup=MainUsers -d username= user1 -d vfs_items@vfs_items.XML -d permissions@VFS.XML -u crushadmin:pass http://127.0.0.1:8080/(long line, so get it all)
Groups and Inheritance:
#
Add some users into a group, it will make the group if it doesn't exist:
curl -d command=setUserItem -d xmlItem=groups -d data_action=add -d group_name=MyGroup -d usernames=user1;user2 -u crushadmin:pass http://127.0.0.1:8080/(long line, so get it all)
Delete users from a group:
curl -d command=setUserItem -d xmlItem=groups -d data_action=delete -d group_name=MyGroup -d usernames=user1;user2 -u crushadmin:pass http://127.0.0.1:8080/(long line, so get it all)
Delete an entire group:
curl -d command=setUserItem -d xmlItem=groups -d data_action=delete -d group_name=MyGroup -u crushadmin:pass http://127.0.0.1:8080/(long line, so get it all)
Add some users to inheritance, it will make the inheritance if it doesn't exist:
curl -d command=setUserItem -d xmlItem=inheritance -d data_action=add -d inheritance_name=AdmminTemplate -d usernames=user1;user2 -u crushadmin:pass http://127.0.0.1:8080/(long line, so get it all)
Delete users from an inheritance item:
curl -d command=setUserItem -d xmlItem=inheritance -d data_action=delete -d inheritance_name=AdmminTemplate -d usernames=user1;user2 -u crushadmin:pass http://127.0.0.1:8080/(long line, so get it all)
Delete an entire inheritance:
curl -d command=setUserItem -d xmlItem=inheritance -d data_action=delete -d inheritance_name=AdmminTemplate -u crushadmin:pass http://127.0.0.1:8080/(long line, so get it all)
API Tool:
#
java -jar CrushTunnel.jar https://crushamdin:password@yourserver.com/ user user_add MainUsers user3 password=password user vfs_add MainUsers user3 path=/home/ privs=(read)(write)(resume)(delete)(view) url=file://home/ name=home
Add new attachment
List of attachments
Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
---|---|---|---|---|---|---|
xml |
permissions.xml | 0.2 kB | 1 | 09-Oct-2016 18:14 | Ben Spink | |
xml |
user.xml | 0.2 kB | 1 | 09-Oct-2016 18:14 | Ben Spink | |
xml |
vfs_items.xml | 0.3 kB | 1 | 09-Oct-2016 18:14 | Ben Spink |