How to manipulate users from other site (in code)

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
6/4/2007 11:42:59 AM
Gravatar
Total Posts 488

How to manipulate users from other site (in code)

I am trying to create a portal of 2 sites: one is for visitors, the second one is a management site. I do not want to make it the same site for some design reasons, plus I want to use "list members" functionality.

According to this, I need to write some code to manipulate (create, view/edit profile) users from another site of the same portal, so that managers logged in to the second site could create user accounts for the first one.

 

I need the following operations:

1. Create user of another portal

2. Assign some roles to the user created

3. View/edit profile of the user created

What should I use to perform this?

6/5/2007 2:16:04 PM
Gravatar
Total Posts 18439

Re: How to manipulate users from other site (in code)

Well its certainly possible to do that in code but I have no plans to implement such a feature so you would need to do that yourself if you really need it. My goal has been to ensure that the sites are completely separate in terms of users. I don't want to build any security holes in that model.

I think there is already a feature to filter specific users from the member list, if not I would be willing to implement that so that the admin users could be unlisted.

I've been working on a feature for a client that might be of interest to you though and might allow you to approach theyour goal from a different angle. It allows creating visual sub sites that have their own skins and look like independent sites but they share the same users with the parent site because it is really just the same site but with section home pages that show only the pages beneath the section in the menu(s). The member list is not filtered though since it really is all one site.

My clients needs are top level

University Site
--School of Foo (Section Home)
--School of Bar (Section home)
--School of Music (Section home)

with each section having its own skin and logo and menu. In fact each section home has a split menu skins with a top horizntal menu showing sub sections within the section and child pages below the sub section shown in a left vertical menu

The logo, home link etc all point to the section home rather than the root site home.

I haven't created the officla documentation yet, but its in svn and these are the notes I sent my client for testing:

1. Create the page hierarchy something along these lines
University of Music (main root site)
--School of Jazz ( apparently a separate site) (siteRoot/schoolofjazz.aspx)
----Swing Department (section of sub site) (in split menu this would
be the top menu)
------Some page 1 (in split menu this will be the top level of the
left menu when
-------- ... more pages later

Create a custom skin for the School Of Jazz by copying one of the
split menu skins like treeview2. Set that page to use this skin, then
in the layout.master file
1. edit the home link so it points to the School of Jazz page like this:

<portal:HomeLink id="HomeLink" runat="server"
OverrideUrl="~/schoolofjazz.aspx" />

2. edit the site logo so it links to the Schol Of Jazz page and use
its own logo if desired.

<portal:SiteLogo id="SiteLogo" runat="server"
OverrideUrl="~/schoolofjazz.aspx"
OverrideImageUrl="~/Data/Sites/1/logos/mojotonguesmall.gif"></portal:SiteLogo>

3. edit the site title like this:

<portal:SiteTitle id="SiteTitle" runat="server"
OverrideUrl="~/schoolofjazz.aspx" OverrideTitle="School of
Jazz"></portal:SiteTitle>

4. Set the StartingNodeOffset=1 on the top SiteMenu, this makes the
top menu bind to node beneath School of Jazz

<portal:SiteMenu id="SiteMenu1" runat="server"
UseTreeView="false"
TopLevelOnly="true"
StartingNodeOffset="1"
Direction="Horizontal">
</portal:SiteMenu>

5. On the page menu set StartingNodeOffset=2

<portal:PageMenu id="PageMenu1" runat="server" UseTreeView="true"
StartingNodeOffset="2" />

New pages created below School of Jazz should automatically get the
same skin as the School of Jazz page.

Joe

6/6/2007 4:10:06 AM
Gravatar
Total Posts 488

Re: How to manipulate users from other site (in code)

Joe,

1. I agree with the model of completely separate sites from the non-programmer's point of view. The question was about the code only (that's why this thread is not in the "feature requests" forum).

2. About filtering specific users from the member list, I already asked about this, my position is there: http://www.mojoportal.com/ForumThreadView.aspx?thread=768&pageid=5&ItemID=1

3. Thanks for telling about the new feature. I am not sure it is good in my case, but i shall look into it.

4. By the way, is there now a way to code creation of user of another site and adding it to some roles?

6/6/2007 7:11:46 AM
Gravatar
Total Posts 18439

Re: How to manipulate users from other site (in code)

1. You can do it in code. Its just a matter of assigning the user the siteid by passing in SiteSettings to the constructor.

2. When I get to more work on the Site Office feature I will implement user groups which can be used to filter users. In practice these groups may correspond to roles, but I just don't think it would be wise to use roles directly for this as I don't think it is wise to enumerate the roles for visitors.

4. Yes if you are looking for code example, look in the mojoPortal.Business.WebHelpers.mojoSetup.cs. When a new site is created from Site Settings, it creates an admin user for the site and adds him to the Admins role

Joe

6/6/2007 12:29:47 PM
Gravatar
Total Posts 488

Re: How to manipulate users from other site (in code)

Thanks, code example was exactly what I needed.

You must sign in to post in the forums. This thread is closed to new posts.