I have created a simple GRID to allow users to self register.
I ask for their:
Name
Email (to be used as their user ID)
Password
The group they belong to is set to "applicant" until they they click on a link to register that is contained in an email that is sent to them.
What I cannot get the code to do is to save the group GUID that is related to this applicant.
Please note that the groups marked NULL where added with my GRID only as where all of the other entries, but I used the group security tool to add them to the applicant group.
In the debugger I can see that the GroupGUID that is being passed matches up in the the groups table.
Any help here would be greatly appreciated.
Thanks,
Michael Carroll
www.redrocksbluesky.com
[email protected]
435-275-5170
I ask for their:
Name
Email (to be used as their user ID)
Password
The group they belong to is set to "applicant" until they they click on a link to register that is contained in an email that is sent to them.
What I cannot get the code to do is to save the group GUID that is related to this applicant.
Code:
function OnGridInitialize as v (e as p) ''''' Ok now we need to make the security framework avaiable to the grid '''''' dim request as p dim session as p dim response as p request = e.tmpl.request session = e.rv.session 'response = e.tmpl.response end function function AfterInsertRecord as v (e as p) '''' Ok lets write data to the security table ''''''' dim uservalue as p dim uservalue.guid as c dim uservalue.userid as c dim uservalue.ulink as c dim uservalue.group as c dim uservalue.password as c dim groupGuid as c groupGuid = a5ws_get_guid_from_group("applicant",request) uservalue.userid = e.DataSubmitted.userid uservalue.ulink = e.DataSubmitted.userid uservalue.group = groupGuid uservalue.password = e.DataSubmitted.password dim output as p dim output.controls as p dim output.controls.guid.value as c dim result as p result = a5ws_Save_WebUser_Values(output,uservalue,e.GridDefinition.request) if result.errors = .t. result.errorHTML = result.error_test end if end function
Code:
Here is the results mysql> select * from myusers_groups; +---------------------+------------+ | userid | group_name | +---------------------+------------+ | [email protected] | applicant | | [email protected] | applicant | | [email protected] | admin | | [email protected] | applicant | | [email protected] | applicant | | [email protected] | NULL | | [email protected] | NULL | | [email protected] | applicant | +---------------------+------------+ 8 rows in set (0.06 sec)
In the debugger I can see that the GroupGUID that is being passed matches up in the the groups table.
Code:
mysql> select * from websecurity_groups where websecurity_groups.group_guid = "09b52013a54d41db98035048aff6a21a"; +----------+----------------------------------+------------+--------+---------------------+ | group_id | group_guid | group_name | updweb | updlocal | +----------+----------------------------------+------------+--------+---------------------+ | 2 | 09b52013a54d41db98035048aff6a21a | applicant | NULL | 2010-12-14 23:14:06 | +----------+----------------------------------+------------+--------+---------------------+ 1 row in set (0.00 sec)
Thanks,
Michael Carroll
www.redrocksbluesky.com
[email protected]
435-275-5170
Comment