Custom Control and Members Options
andrew
Posted: Friday, November 14, 2008 9:23:29 AM

Rank: Enthusiast

Joined: 2/28/2008
Posts: 36
Location: South Africa
Hi All

Prepare for a multi-faceted question..Whistle

This is a follow on from a previous Post, which ismail was helping me with. I am busy developing a collection of user controls that require non-standard user registration and specific usernames (related to an autogenerated ID). Added to this, there are user specific reports and administrator reports. Through my previous post, Ismail helped me by pointing me to Umbraco members as well as the memeber controls package. I have never really used memebers and this looks like the right way forward. So, a couple of questions:

1. Could someone please give me a brief explanation how members works. in particular, thew relation between members, member types and member groups. How does it store isauthenticated throughout the pages (cookies? session variables?)

2. With member access control, is it possible to hide the page from navigation until someone is logged in. (i suppose you could do it through your menu xslt..Think )

3. Will I be able to relate my login page with my username and password (all coming from an external database) to a member, and make it work the same way as a normal member .i.e. only display page when logged in, and only display page if member of administrator page etc..

4. Where do I start! - I have the member control source, which is quite difficult to work through if you do not have a complete understanding of how members work

Thanks for the time
imayat12
Posted: Friday, November 14, 2008 10:01:53 AM

Rank: Addict

Joined: 7/19/2006
Posts: 670
Location: Preston, UK
Andrew,

1. Member groups are groups that members can belong to. You allow groups permissions to view pages. Member type is the definition for members. Namely when using member controls which fields the user has to fill in Name, last name, telephone no etc etc. The visibility of these fields is detemined by setting the property in the fields definition for member type namely "Member can edit" this is in the info tab. Members are instances of a given member type.

2. You are correct you do it through xslt the function is

Code:


<!--  if page is protected and user currently logged in user has access show the page -->
<xsl:if test="umbraco.library:IsProtected(./@id, ./@path) = 0 or (umbraco.library:IsProtected(./@id, ./@path) = 1 and umbraco.library:HasAccess(./@id, ./@path) = true())">

</xsl:if>




3. You are in luck Rueben recently did post about something similar on his blog

4. I would get 1 - 2 working first then get onto 3.

Regards

Ismail

Level 2 certified. If it aint broke dont fix.
andrew
Posted: Friday, November 14, 2008 10:16:57 AM

Rank: Enthusiast

Joined: 2/28/2008
Posts: 36
Location: South Africa
Ismail - Thanks!

That looks like just enough to get me going.

So if I understand correctly, because I have my own custom control for registration - I can have a dummy member type for creating the user, and assign that user to the appropriate member group. I think rueben's blog will get me going in the right direction. I will persevere with this, and if I get stuck - revisit this post - thanks again!

On a side note - Why i like the Umbraco forum
1. Quick helpful responses
2. A large user base in the proximity of the GMT time zone -which means I do not have to wait for the end of the day for responses!
imayat12
Posted: Friday, November 14, 2008 3:46:53 PM

Rank: Addict

Joined: 7/19/2006
Posts: 670
Location: Preston, UK
Andrew,

With your third party integration as per Reubens example you do your login and after this check if user exists in umbraco if not then create one. This user will just be marker so that you can apply the umbraco security and restrict access the authentication etc is still with your third party system.

Quote:

1. Quick helpful responses


Its not called the friendly cms for nothing!!

Regards

Ismail

Level 2 certified. If it aint broke dont fix.
andrew
Posted: Saturday, November 15, 2008 10:04:31 PM

Rank: Enthusiast

Joined: 2/28/2008
Posts: 36
Location: South Africa
Thanks for the help - that was painless to do...very simple! One extra question - Is it possible to add a parameter to the membercache (i.e. UserID). That way when I login, I can pass the userId from my db to the cache, and use it for subsequent pages.

At the moment I have associated the member.id with the user in my own db, which works fine, as I can use it to get my userid for other pages. I was just wondering if I could do it the other way?

Thanks
andrew
andrew
Posted: Tuesday, November 18, 2008 1:32:16 PM

Rank: Enthusiast

Joined: 2/28/2008
Posts: 36
Location: South Africa
Hi

I have created an update user details page, and implemented the following code in my user control:
Code:

Dim m As Member = Member.GetCurrentMember()
            If txt1upass.Text <> "" Then
                m.Password = txt1upass.Text
            End If
            m.Email = txtuemail.Text
            m.User.Name = txtufirstname.Text & " " & txtulastname.Text
        End If


While testing this, I was also logged into the umbraco backend in another tab. This code updated the details of my umbraco user, and not the logged in member user. The odd thing is that I have successfully used the code in another usercontrol when assigning a member id to my own database (while I was logged in).

So: are umbraco user and members linked? -specifically when using GetCurrentMember, and how else would I get the logged in Member (not Umbraco user). What about getting a member by Id?

Thanks
Andrew
andrew
Posted: Tuesday, November 18, 2008 3:27:38 PM

Rank: Enthusiast

Joined: 2/28/2008
Posts: 36
Location: South Africa
ahhh - i found the gremlin - m.user.name - through trial and error, I see i should use m.text!!
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.