The post you refer to does not tackle this problem completely. Indead the username can only exists once in the complete DNN installation. The ASP membership takes care of the username + password. However, to give a user access to a particular portal you must create an entry in DNN_PortalUsers for every portal:
Sample: Userid, portalid, id of dnn_portalusers, create date, authorised
70882 |
7 |
35 |
3-7-2007 0:00:00 |
True |
70882 |
0 |
36 |
3-7-2007 0:00:00 |
True |
70882 |
9 |
37 |
3-7-2007 0:00:00 |
True |
If you do this, another side effect may occur (or maybe because I have been playing around with profile settings as well): the username, pwd, first and lastname and email stay the same in every childportal, however, the user profile not. So for every child portal the user data is different. That is not what you want. Or you do not want to use the dnn profile...
I am interested in the custom asp membership provider as is given above. I think of writing also my own. Maybe somebody wants to jump in? I think of next:
- A fixed "main portal" is indicated by an additional column in Portals table. So every child has a "main portal" PortalId in this colum MainPortalId
- If properties are looked up, they are retrieved from the "main portal". This is done through this additional column "MainPortalId". Also storage is done there.
- GetUserByName and GetUser are looking up this main portal
- In the table UserPortals it is best to keep one entry since otherwise the user admin will not work.
Above solution will bundle users to several portals. I tried to be somewhat cruel and changed "GetUserByName" and "GetUser" to get a "single login" feature in DNN. This works fine:
ALTER PROCEDURE [dbo].[V4A_DNN_GetUserByUsername]
@PortalId int,
@Username nvarchar(100)
AS
SELECT
UserID
,0 AS PortalId --@PortalId
,Username
,FirstName
,LastName
,DisplayName
,IsSuperUser
,Email
,AffiliateId
,UpdatePassword
,COALESCE(Authorised, 1) AS Authorised
FROM
V4A_DNN_vw_Users
WHERE Username = @Username
-- AND (PortalId = @PortalId OR IsSuperUser = 1 OR @PortalId is null)
ALTER PROCEDURE [dbo].[V4A_DNN_GetUser]
@PortalId int,
@UserId int
AS
SELECT
UserID
,0 AS PortalId --@PortalId
,Username
,FirstName
,LastName
,DisplayName
,IsSuperUser
,Email
,AffiliateId
,UpdatePassword
,COALESCE(Authorised, 1) AS Authorised
FROM
V4A_DNN_vw_Users
WHERE UserId = @UserId
However, it does have the same problem as by the other solution with additional entry in PortalUsers. So I guess the profile it collected with the portalId instead of the Portalid of the user...or the sp doing this needs similar modification as above. Changing GetProfile does not have the required effect. It seems the profile is first collected for the portal itself and then the profile of a user is copied in. However, the propertydefinitions do not match in that case :-( Who helps me out? I am interested in the custom asp provider since this are considered: "core modifications".....