def resellerCenter(request): try: userID = request.session['userID'] currentACL = ACLManager.loadedACL(userID) if currentACL['admin'] == 1: userNames = ACLManager.loadDeletionUsers(userID, currentACL) resellerPrivUsers = ACLManager.userWithResellerPriv(userID) return render( request, 'userManagment/resellerCenter.html', { 'userToBeModified': userNames, 'resellerPrivUsers': resellerPrivUsers }) elif currentACL['resellerCenter'] == 1: userNames = ACLManager.loadDeletionUsers(userID, currentACL) resellerPrivUsers = ACLManager.userWithResellerPriv(userID) return render( request, 'userManagment/resellerCenter.html', { 'userToBeModified': userNames, 'resellerPrivUsers': resellerPrivUsers }) else: return ACLManager.loadError() except KeyError: return redirect(loadLoginPage)
def userWithResellerPriv(self): try: userID = self.admin.pk allUsers = ACLManager.userWithResellerPriv(userID) json_data = "[" checker = 0 for user in allUsers: dic = { "userName": user, } if checker == 0: json_data = json_data + json.dumps(dic) checker = 1 else: json_data = json_data + ',' + json.dumps(dic) json_data = json_data + ']' final_json = json.dumps({ 'status': 1, 'error_message': "None", "data": json_data }) return HttpResponse(final_json) except BaseException, msg: return self.ajaxPre(0, str(msg))
def listUsers(request): try: userID = request.session['userID'] currentACL = ACLManager.loadedACL(userID) if currentACL['admin'] == 1: aclNames = ACLManager.unFileteredACLs() elif currentACL['changeUserACL'] == 1: aclNames = ACLManager.unFileteredACLs() elif currentACL['createNewUser'] == 1: aclNames = ['user'] else: aclNames = [] if currentACL['admin'] == 1: resellerPrivUsers = ACLManager.userWithResellerPriv(userID) elif currentACL['resellerCenter'] == 1: resellerPrivUsers = ACLManager.userWithResellerPriv(userID) else: resellerPrivUsers = [] if currentACL['admin'] == 1: return render(request, 'userManagment/listUsers.html', { 'aclNames': aclNames, 'resellerPrivUsers': resellerPrivUsers }) elif currentACL['listUsers'] == 1: return render(request, 'userManagment/listUsers.html', { 'aclNames': aclNames, 'resellerPrivUsers': resellerPrivUsers }) else: return ACLManager.loadError() except KeyError: return redirect(loadLoginPage)