Commit 6a0317d6 authored by Rush's avatar Rush Committed by Gerrit Code Review
Browse files

Merge "getwikirights: quick and dirty script to show user rights onwiki(s)"

parents 6246d965 b2f45081
# Get global and per wiki rights for a user
import requests
except ImportError:
print('Install requests3 library')
import getpass
import sys
import json
def main():
user = sys.argv[1]
req = '{}&guiprop=groups%7Crights%7Cmerged'
req_user = req.format(user)
r = requests.get(req_user)
results = json.loads(r.content.decode('utf-8'))
if '-v' in sys.argv:
global_groups = ','.join(results['query']['globaluserinfo']['groups'])
print('global: {}'.format(global_groups))
wikis = results['query']['globaluserinfo']['merged']
wap = {}
for w in wikis:
if 'groups' in w:
wiki = w['wiki']
rights = ','.join(w['groups'])
print("{}: {}".format(wiki, rights))
if __name__ == '__main__':
Supports Markdown
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