How was the My Account page on O Gallery done?

Topics: General
May 7, 2011 at 1:11 AM

OK, this is a super noob question:

I was just checking  out the Orchard Gallery and the link: http://orchardproject.net/gallery/Contribute/MyAccount

returns different data depending if you are logged on or not. If you are logged in it displays your access key and if you are not it displays a Log On (part?) dialog on part of the page.

Since the gallery is running Orchard, I assume this is stock Orchard functionality and not some custom modification.

I have to imagine that lots of people want this functionality and I would really appreciate it if someone would indulge me by walking through how it was done using baby steps.

Thanks.

Coordinator
May 7, 2011 at 1:19 AM

If you go to the source code for the gallery, in Controllers/ContributeController (http://orchardgallery.codeplex.com/SourceControl/changeset/view/6a5476676f50#Controllers%2fContributeController.cs), this is the MyAccount action, for which the source code is:

[HttpGet]
[Authorize]
public ActionResult MyAccount() {
    IUser authenticatedUser = _authenticationService.GetAuthenticatedUser();
    return View(_userkeyService.GetAccessKeyForUser(authenticatedUser.Id));
}

The key part here is the Authorize attribute.

May 7, 2011 at 1:33 AM

Thank you Bertrand, but I was not clear. I was not asking how it was accomplished in code, I was asking how the person (end user) setting up the Orchard site creates a page like this.

Coordinator
May 7, 2011 at 1:35 AM

You don't. There is currently no way of applying per-item permissions. It's a very common request though. This here works because there is a specific controller action behind it.

Coordinator
May 7, 2011 at 5:59 AM

You might also want to try the Profile module, which lets you add Parts and Field to a User, for customization and display. It is editable when a User is logged in, and you can choose to let other users display it or not.