示例#1
0
 def form_on_valid(self):
     formvals = self.form.get_values()
     # assigned groups and permissions stay the same for profile submissions
     formvals['assigned_groups'] = self.objinst.group_ids
     formvals['approved_permissions'], formvals['denied_permissions'] = \
         self.objinst.assigned_permission_ids
     formvals['pass_reset_ok'] = False
     orm_User.edit(self.objid, **formvals)
     session_user.add_message('notice', 'profile updated succesfully')
示例#2
0
def test_user_update():
    u = create_user_with_permissions()
    current_hash = u.pass_hash
    u = User.edit(u.id, pass_hash=u'123456')
    assert u.pass_hash == current_hash

    u.reset_required = False
    db.sess.commit()
    u = User.edit(u.id, email_notify=True)
    assert not u.reset_required
    u = User.edit(u.id, password='******')
    assert u.reset_required
示例#3
0
def test_user_group_assignment():
    g1 = Group.add_iu(name=u'group_for_testing_%s' % randchars(15))
    g2 = Group.add_iu(name=u'group_for_testing_%s' % randchars(15))

    u = create_user_with_permissions()
    assert u.groups == []

    User.edit(u.id, assigned_groups=[g1.id, g2.id])
    assert len(u.groups) == 2
    assert len(g1.users) == len(g2.users) == 1

    User.edit(u.id, assigned_groups=g2.id)
    assert len(u.groups) == 1
    assert u.groups[0].id == g2.id
示例#4
0
 def test_users_manage_name_filter(self):
     u = User.testing_create()
     User.edit(u.id, name_first=u'Jack', name_last=u'Frost')
     r = self.c.get('/users/manage?op(name)=contains&v1(name)=Frost')
     assert b'<td>Jack Frost</td>' in r.data