Exemplo n.º 1
0
def create():
    """
    Create role.

    :return:
    """

    if request.form:
        form = RoleForm(MultiDict(request.form))
    else:
        form = RoleForm()

    if form.validate_on_submit():
        roles.create_role(**request.form)
    else:
        return {}, 500
    return {}
Exemplo n.º 2
0
 def run(self):
     kwargs = MultiDict(dict(name="admin", description="webmaster"))
     role = roles.create_role(**kwargs)
     kwargs = MultiDict(dict(registrationEmail="*****@*****.**", registrationPassword="******"))
     user = users.create_user(**kwargs)
     if users.add_role_to_user(user, role):
         print "[email protected] got admin role successfully."
         return
     print "Init user failed."
Exemplo n.º 3
0
 def run(self):
     kwargs = MultiDict(dict(name='admin', description='webmaster'))
     role = roles.create_role(**kwargs)
     kwargs = MultiDict(
         dict(registrationEmail='*****@*****.**',
              registrationPassword='******'))
     user = users.create_user(**kwargs)
     if users.add_role_to_user(user, role):
         print '[email protected] got admin role successfully.'
         return
     print 'Init user failed.'