def create_role(self, **kwargs): """ Create a role. :param kwargs: :return: """ kwargs = DictEncoder.encode(kwargs) role = security.datastore.find_or_create_role(**kwargs) db.session.commit() return role
def create_user(self, **kwargs): """ Create a new user. (Registration) :param kwargs: :return: """ kwargs = DictEncoder.encode(kwargs) kwargs['email'] = kwargs.pop('registrationEmail') kwargs['password'] = kwargs.pop('registrationPassword') # for k in kwargs: # print(k) user = register_user(**kwargs) db.session.commit() return user