def test_sort_user_links(self): user = db_utils.create_user() links = [ { 'userid': user, 'link_type': 'Twitter', 'link_value': 'Weasyl', }, { 'userid': user, 'link_type': 'Email', 'link_value': 'mailto:[email protected]', }, { 'userid': user, 'link_type': 'Twitter', 'link_value': 'WeasylDev', } ] d.engine.execute(d.meta.tables['user_links'].insert().values(links)) test_user_profile = profile.select_manage(user) self.assertEqual(test_user_profile['sorted_user_links'], [ ('Email', ['mailto:[email protected]']), ('Twitter', ['Weasyl', 'WeasylDev']), ])
def control_editemailpassword_get_(request): return Response(define.webpage( request.userid, "control/edit_emailpassword.html", [profile.select_manage(request.userid)["email"]], title="Edit Password and Email Address" ))
def admincontrol_manageuser_get_(request): form = request.web_input(name="") otherid = profile.resolve(None, None, form.name) if not otherid: raise WeasylError("userRecordMissing") if request.userid != otherid and otherid in staff.ADMINS and request.userid not in staff.TECHNICAL: return Response(d.errorpage(request.userid, errorcode.permission)) return Response(d.webpage(request.userid, "admincontrol/manageuser.html", [ # Manage user information profile.select_manage(otherid), ], title="User Management"))
def GET(self): form = web.input(name="") otherid = profile.resolve(None, None, form.name) if not otherid: raise WeasylError("userRecordMissing") if self.user_id != otherid and otherid in staff.ADMINS and self.user_id not in staff.TECHNICAL: return d.errorpage(self.user_id, errorcode.permission) return d.webpage(self.user_id, "admincontrol/manageuser.html", [ # Manage user information profile.select_manage(otherid), # only technical staff can impersonate users self.user_id in staff.TECHNICAL, ])
def admincontrol_manageuser_get_(request): otherid = profile.resolve(None, None, request.params.get('name', '')) if not otherid: raise WeasylError("userRecordMissing") if request.userid != otherid and otherid in staff.ADMINS and request.userid not in staff.TECHNICAL: raise WeasylError('InsufficientPermissions') return Response( d.webpage( request.userid, "admincontrol/manageuser.html", [ # Manage user information profile.select_manage(otherid), ], title="User Management"))
def GET(self): form = web.input(name="") otherid = profile.resolve(None, None, form.name) if not otherid: raise WeasylError("userRecordMissing") if self.user_id != otherid and otherid in staff.ADMINS and self.user_id not in staff.TECHNICAL: return d.errorpage(self.user_id, errorcode.permission) return d.webpage( self.user_id, "admincontrol/manageuser.html", [ # Manage user information profile.select_manage(otherid), # only technical staff can impersonate users self.user_id in staff.TECHNICAL, ])
def test_remove_social_links(self): user = db_utils.create_user() links = [ { 'userid': user, 'link_type': 'Twitter', 'link_value': 'Weasyl', }, { 'userid': user, 'link_type': 'Email', 'link_value': 'mailto:[email protected]', }, ] d.engine.execute(d.meta.tables['user_links'].insert().values(links)) profile.do_manage(self.mod, user, remove_social=['Email']) test_user_profile = profile.select_manage(user) self.assertEqual(test_user_profile['sorted_user_links'], [('Twitter', ['Weasyl'])])
def control_editemailpassword_get_(request): return Response(define.webpage(request.userid, "control/edit_emailpassword.html", [profile.select_manage(request.userid)["email"]]))
def GET(self): return define.webpage(self.user_id, "control/edit_emailpassword.html", [profile.select_manage(self.user_id)["email"]])
def control_editemailpassword_get_(request): return Response(define.webpage(request.userid, "control/edit_emailpassword.html", [profile.select_manage(request.userid)["email"]]))
def GET(self): return define.webpage(self.user_id, "control/edit_emailpassword.html", [profile.select_manage(self.user_id)["email"]])