# Propose hrn
-def manifold_add_user(user_params):
- # user_params: email, password
+def manifold_add_user(request, user_params):
+ # user_params: email, password e.g., user_params = {'email':'aa@aa.com','password':'demo'}
query = Query.create('local:user').set(user_params).select('email')
- results = execute_query(query)
+ results = execute_query(request,query)
if not results:
raise Exception, "Failed creating manifold user: %s" % user_params['email']
result, = results
return result['email']
-def manifold_add_account(account_params):
+def manifold_update_user(request, user_params):
+ # user_params: email, password e.g., user_params = {'password':'demo','config':'{"firstname":"ME"}'}
+ query = Query.update('local:user').set(user_params).select('email')
+ results = execute_query(request,query)
+ if not results:
+ raise Exception, "Failed updating manifold user: %s" % user_params['email']
+ result, = results
+ return result['email']
+
+
+#def manifold_update_user(request,user_params):
+# # user_params: password and config
+# query = Query.update('local:user').set(user_params).select(['password','config'])
+# results = execute_query(request,query)
+# if not results:
+# raise Exception, "Failed updating manifold user: password %s and config %s" % (user_params['password'],user_params['config'])
+# result, = results
+# return (result['password'],result['config'])
+
+
+def manifold_add_account(request, account_params):
query = Query.create('local:account').set(account_params).select(['user', 'platform'])
- results = execute_query(query)
+ results = execute_query(request,query)
if not results:
raise Exception, "Failed creating manifold account on platform %s for user: %s" % (account_params['platform'], account_params['user'])
result, = results
return (result['user'], result['platform'])
+def manifold_update_account(request,account_params):
+ # account_params: config
+ query = Query.update('local:account').set(account_params).select('config')
+ results = execute_query(request,query)
+ if not results:
+ raise Exception, "Failed updating manifold account: config %s" % account_params['config']
+ result, = results
+ return result['config']
+
+
def make_request_user(user):
request = {}
request['type'] = 'user'
-
-
+table.mytable { border-collapse: collapse; border: 1px solid #839E99;
+background: #f1f8ee; font: .9em/1.2em Georgia, "Times New Roman", Times, serif; color: #033;table-layout:fixed; }
+.mytable caption { font-size: 1.3em; font-weight: bold; text-align: left; padding: 1em 4px; }
+.mytable td, th { padding: 3px 3px .75em 3px; line-height: 1.3em; }
+.mytable th { background: #839E99; color: #fff; font-weight: bold; text-align: left; padding-right: .5em; vertical-align: top; align="center" style="width:15%;word-wrap: break-word" }
+.mytable thead th { background: #2C5755; text-align: center; }
+.mytable thead td {style="width:15%;word-wrap: break-word"}
+.mytable .odd td { background: #DBE6DD; style="width:15%;word-wrap: break-word"}
+.mytable .odd th { background: #6E8D88; }
+.mytable td a, td a:link { color: #325C91; }
+.mytable td a:visited { color: #466C8E; }
+.mytable td a:hover, td a:focus { color: #1E4C94; }
+.mytable th a, td a:active { color: #fff; }
+.mytable tfoot th, tfoot td { background: #2C5755; color: #fff; }
+.mytable th + td { padding-left: .5em; }
<h2>Platform Access</h2>
-<table border="2" bordercolor="#C1DAD7" style="table-layout:fixed;background-color:FFFFFF;width:830px" cellpadding="12" cellspacing="12" align="center">
- <tr>
- <th align="center" style="width:15%">Platform</th>
- <th align="center" style="width:15%">Account Type</th>
- <th align="center" style="width:15%">user_hrn</th>
- <th align="center">Pub Key</th>
+<table class="mytable">
+ <tr class="odd">
+ <th>Platform</th>
+ <th>Account Type</th>
+ <th>user_hrn</th>
+ <th>Pub Key</th>
</tr>
{% for row in data %}
- <tr>
- <td align="center"> {{ row.platform_name }} </td>
- <td align="center"> {{ row.account_type }} </td>
- <td align="center" style="word-wrap: break-word"> {{ row.usr_hrn }} </td>
- <td align="center" style="word-wrap: break-word"> {{ row.usr_pubkey }} </td>
+ <tr class="even">
+ <td class="odd"> {{ row.platform_name }} </td>
+ <td class="even"> {{ row.account_type }} </td>
+ <td class="odd"> {{ row.usr_hrn }} </td>
+ <td class="even"> {{ row.usr_pubkey }} </td>
</tr>
{%endfor%}
</table>
from portal.forms import SliceRequestForm, ContactForm
from portal.util import RegistrationView, ActivationView
from portal.models import PendingUser, PendingSlice
-from portal.actions import authority_get_pi_emails, get_request_by_authority
+from portal.actions import authority_get_pi_emails, get_request_by_authority, manifold_add_user, manifold_update_user
from manifold.core.query import Query
from manifold.manifoldapi import execute_query
from unfold.page import Page
# select the logged in user [for the moment hard coded]
#get_user = PendingUser.objects.get(id='1') # here we will get the id/email from session e.g., person.email
# update first and last name
- get_user.first_name = edited_first_name
- get_user.last_name = edited_last_name
- get_user.save()
+ #get_user.first_name = edited_first_name
+ #get_user.last_name = edited_last_name
+ #get_user.save()
+ #user_params = {'config':'hello'}
+ #query = Query.update('local:user').set(user_params).select('config')
+ #results = execute_query(request,query)
+ #if not results:
+ # raise Exception, "Failed to update user: %s" % user_params['config']
+ #result, = results
+ #return result['config']
+ # create user is working fine :)
+ #user_params = ({'config':'"firstname":"HELLO"'},{'password':'hello'})
+ #user_params = { 'config':'{"firstname":"HEY"}'}
+ #user_params = {'email':'aa@aa.com','password':'demo'}
+ #manifold_add_user(request,user_params)
+ #manifold_update_user(request,user_params)
return HttpResponse('Sucess: First Name and Last Name Updated!')
elif 'submit_pass' in request.POST: