Commit b2f45081 authored by cpettet's avatar cpettet
Browse files

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

Lots of room for improvement but want to share.

Change-Id: I02bf9f95ca63132de89e60958f28af4d40a1b565
parent be880c34
# 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