Commit 9f27ce29 authored by Cool Fire's avatar Cool Fire
Browse files

Allow setting shallow archived users to deep archived state

parent dcb9f4f1
Pipeline #2746 passed with stage
in 1 minute and 42 seconds
......@@ -229,6 +229,11 @@ Mark list of users as archived
- Requires administrative privileges
- Requires additional parameter to be set: `usernames`
### Function: `POST /v1/user/deeparchive`:
Mark shallow archived users as deep archived
- Requires API key in `key` parameter to access
- Requires administrative privileges
### Function: `POST /v1/user/unarchive`:
Unmark user as archived
- Requires API key in `key` parameter to access
......
......@@ -213,6 +213,23 @@ class Manager2Api < Sinatra::Base
done.join(',')
end
def users_deep_archive
data = git_get
done = []
data.each do |username, config|
if config['properties'].key?('archived') && config['properties']['archived'] == true
data[username]['properties']['archived'] = 'deep'
done.push username
end
end
git_put data, "Deep archived users: #{done}"
log_info "Deep archived users: #{done}"
done.join(',')
end
# Unarchive a single user
def user_unarchive(username)
data = git_get
......
......@@ -71,6 +71,14 @@ class Manager2Api < Sinatra::Base
erb :result, locals: { message: 'Users archived', result: result }
end
# Mark shallow archived users as deep archived
post '/v1/user/deeparchive' do
check_key_admin(params)
result = users_deep_archive
erb :result, locals: { message: 'Users deep archived', result: result }
end
# Unmark user as archived
post '/v1/user/unarchive' do
check_key(params)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment