Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/henriwahl/seafadm

Seafile web interface wrapper for administration via CLI
https://github.com/henriwahl/seafadm

admin cli python seafile

Last synced: about 2 months ago
JSON representation

Seafile web interface wrapper for administration via CLI

Awesome Lists containing this project

README

        

seafadm - Seafile CLI Administration
====================================

ABOUT:
------

Seafadm allows to do some administration tasks for Seafile (https://github.com/haiwen/seafile) from command line. It collects informations and executes commands by internally calling the web interface of Seafile, Seahub. The used BeautifulSoup module allows the command line tool to be seen as a browser from Seahub's perspective.
Using seafadm one can collect informations about users, groups, links and libraries. These objects also can be deleted. Quotas can be set for users and domains. Searches can be done in users, libraries and groups. Reports can be generated to be sent to users by mail.

**Attention:** I try to keep as close as possible with seafadm to the official Seafile releases. There are minor differences between releases which make small corrections necessary. Especially if you use an older version of Seafile you will need to use an older one of seafadm too. See the tags to find a matching version.

REQUIREMENTS:
-------------

Seafadm is tested with Python 2.7 and needs the great BeautifulSoup module from http://www.crummy.com/software/BeautifulSoup/ version 4 as well as the Python Requests library from http://docs.python-requests.org. Fedora and CentOS users do a

yum install python-beautifulsoup4 python-requests

Debian users install via

apt-get install python-bs4 python-requests

Then run simply on command line using the following instructions.

USAGE:
------

seafadm [option...] [command] [argument]

Valid options are:

-c, --config location for config file for URL, username and password
-U, --url URL of Seafile server, e.g. https://seafile.local
-u, --username username of Seafile admin account
-p, --password password for givern username
-F, --force disable confirmation for delete and quota command

Valid commands are:

show show informations about users, libraries, groups and links
add add users, libraries and files
update update user password
delete delete users, libraries, groups and links
quota set quota for single users and whole domains
search search for users, groups and links
report generate report per user to be sent by mail
check check for invalid links
clean check for invalid links and delete them

Arguments for show command:

users show all users, their ID, creation date and quota as list
user show extra details about , its libraries, shares and groups
libs show all libraries, their ID and owners as list
groups show all groups, their ID, owner, creation date and members as list
group show details about single
links show links, their ID, creation date and URL as list ordered by owner
all show extra details about all users

Arguments for add command:

user add user with password
library add library for owner with
files add file from to

Arguments for update command:

password update password with

Arguments for delete command:

user delete
lib delete library with ID
link delete link identified by URL or ID
group delete group identified by group name

Arguments for quota command:

user set quota for to MB
domain set quota for users from to MB
domain not set quota for users NOT from to MB
domain min set quota for users from to a minimum of
MB

Arguments for search command:

user search in users for
group search in groups for
link search in links for

Arguments for report command:

user generate report for user , to be sent by mail for example

Arguments for check command:

links check validity of links and display them ordered by validity

Arguments for clean command:

links check validity of links and delete them if invalid
garbage [threads] [path] run seaf_gc threads for faster garbace collection
[threads] defaults to 10 and [path] to /opt/seafile

CONFIG FILE:
------------

The optional config file allows to omit sensitive information like username and password at the command line. These informations are stored in the config file that has to be given by the --config option and to look like that:

[seafadm]
url=https://seafile.example.com
[email protected]
password=secret

EXAMPLES:
---------

Showing all users, their libraries, groups and memberships:

seafadm -c ./seafadm.conf show all

Showing users as list:

seafadm -c ./seafadm.conf show users

Showing details about one single user:

seafadm -c ./seafadm.conf show user [email protected]

Adding an user:

seafadm -c ./seafadm.conf add user [email protected] bar1234

Adding a library:

seafdm -c ./seafadm.conf add library 'Joe Library' [email protected]

Adding a file:

seafdm -c ./seafadm.com add file './joe photo.jpg' 1c17cddc-2864-407c-8fcf-6a325964d00b

Update user password:

seafdm -c ./seafadm.conf update password [email protected] foo1234

Deleting an user:

seafadm -c ./seafadm.conf delete user [email protected]

Deleting a library:

seafadm -c ./seafadm.conf delete lib 1c17cddc-2864-407c-8fcf-6a325964d00b

Setting quota to 10240 MB for an user:

seafadm -c ./seafadm.conf quota user [email protected] 10240

Setting quota to 4096 MB for users of domain example.com:

seafadm -c ./seafadm.conf quota domain example.com 4096

Setting quota to a minimum of 20480 MB for all users of domain example.com:

seafadm -c ./seafadm.conf quota domain min example.com 20480

Setting quota to 1 MB for all users NOT in domain example.com:share/link/

seafadm -c ./seafadm.conf quota domain not example.com 1

Search for user joe in users:

seafadm -c ./seafadm.conf search user joe

Generate report for user [email protected]

seafadm -c ./seafadm.conf report user [email protected]

Check validity of links

seafadm -c ./seafadm.conf check links

Delete invalid links

seafadm -c ./seafadm.conf clean links