No activity today, make something!
tiddlyweb How do I create or update a User object in code?

20160313160633 cdent  

In a plugin you can create or update a user object as follows:

{{{ from tiddlyweb.model.user import User

username = 'foo'
password = 'monkey'
roles = ['ADMIN', 'science']
user = User(username)
user.set_password(password)
for role in roles:
    user.add_role(role)
environ['tiddlyweb.store'].put(user)

}}}

The code assumes that environ has been populated as expected in a WSGI application.

Note that there is no requirement for roles to be pre-existing. You can use any string you like. It is up to you to manage that (that is, //you// need to keep track of the roles used in the system and what they mean).