|
|
|
Joined: 6/13/2006
Posts: 58
|
|
|
Thanks to your help, i tryed to implement your solution, so i copy your code i dbo.addUser :
....
IF @UserID is null BEGIN INSERT INTO Users ( Username, FirstName, LastName, AffiliateId, IsSuperUser, Email, DisplayName, UpdatePassword ) VALUES ( @Username, @FirstName, @LastName, @AffiliateId, @IsSuperUser, @Email, @DisplayName, @UpdatePassword )
SELECT @UserID = SCOPE_IDENTITY() END
IF ( @DisplayName is null OR @DisplayName = '' ) BEGIN SET @DisplayName = @FirstName + ' ' + @LastName END
...
My problem is it doesn't work, or not really. I explain myself
When a new user log on the intranet, it create a user on mmy DB but without the field Display name, after i have to unauthorized the user, and then only, the display name fill itself
Is it a normal work ?
|
|
|
|
| |
|
|
Joined: 8/2/2005
Posts: 8
|
|
|
cfrancois wrote Thanks to your help, i tryed to implement your solution, so i copy your code i dbo.addUser :
cfransois,
The IF statement should be before the INSERT or UPDATE statement in the procedure, so that @DisplayName is set before database is being updated. I suggest putting it at the top, as the first statement in the stored procedure.
Cheers, Lev.
|
|
|
|
| |
|
|
Joined: 7/28/2006
Posts: 5
|
|
|
Lev Gimelfarb wrote
Darren,
Same issue, installed DotNetNuke last week and got upset from a thought that I would need to manually update Display Names for all users in the company (although 60, not 200!). Being a lazy guy, I always search for easier solutions ...
I have analyzed the current source code, and the only way I could fix the issue is by hacking the database stored procedure. But in the end it works perfectly! Modify the dbo.AddUser stored procedure, and check if the @DisplayName parameter is empty, then make it @Firstname + ' ' + @Lastname:
IF ( @DisplayName is null OR @DisplayName = '' ) BEGIN SET @DisplayName = @FirstName + ' ' + @LastName END
More so, apparently our AD did not have email addresses properly entered for all users. So I put a hack into the stored procedure to infer the email, if it's emtpy. But you don't have such a problem.
The only downside, is that this fix might be overwritten by SQL scripts if dotnetnuke installation is ever upgraded. By that time I am hoping proper fix will be available, though.
Hope this helps (until official fix is posted).
Cheers, Lev.
Hi Lev,
I tried this in my database and it isn't working at all. I'm not getting any name fields at all in my user table. I'm only getting the AD userid.
Here's what my dbo.adduser stored proc looks like:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[AddUser]
@PortalID int,
@Username nvarchar(100),
@FirstName nvarchar(50),
@LastName nvarchar(50),
@AffiliateId int,
@IsSuperUser bit,
@Email nvarchar(256),
@DisplayName nvarchar(100),
@UpdatePassword bit,
@Authorised bit
AS
DECLARE @UserID int
SELECT @UserID = UserID
FROM Users
WHERE Username = @Username
IF ( @DisplayName is null OR @DisplayName = ' ' )
BEGIN
SET @DisplayName = @FirstName + ' ' + @LastName
END
IF @UserID is null
BEGIN
INSERT INTO Users (
Username ,
FirstName ,
LastName ,
AffiliateId ,
IsSuperUser ,
Email ,
DisplayName ,
UpdatePassword
)
VALUES (
@Username ,
@FirstName ,
@LastName ,
@AffiliateId ,
@IsSuperUser ,
@Email ,
@DisplayName ,
@UpdatePassword
)
SELECT @UserID = SCOPE_IDENTITY()
END
IF @IsSuperUser = 0
BEGIN
IF not exists ( SELECT 1 FROM UserPortals WHERE UserID = @UserID AND PortalID = @PortalID )
BEGIN
INSERT INTO UserPortals (
UserID ,
PortalID ,
Authorised
)
VALUES (
@UserID ,
@PortalID ,
@Authorised
)
END
END
SELECT @UserID
My setup is SQL 2000 (MSDE)
DotNetNuke 4.3.4 source
Win2k Server
Any ideas?
Thanks,
David
|
|
|
|
| |
|
|
Joined: 8/2/2005
Posts: 8
|
|
|
catsnak wrote
Hi Lev,
I tried this in my database and it isn't working at all. I'm not getting any name fields at all in my user table. I'm only getting the AD userid.
...
Any ideas?
Thanks,
David
David,
If you are not getting FirstName and LastName passed to stored procedure at all, then it means they cannot be retrieved from AD. Several scenarios when this can happen:
- DotNetNuke cannot access AD and uses failback mechanism (see DotNetNuke.Authentication.ADSIProvider source). But in this case it makes up FirstName and LastName based on the NTLM username.
- Expected fields are not received from AD. Check that "givenName" and "sn" exist for the user entry in AD. Can use any LDAP browser. (e.g. http://www.topshareware.com/LDAP-Browser-download-41756.htm).
Hope this helps
Lev
|
|
|
|
| |
|
|
Joined: 7/28/2006
Posts: 5
|
|
|
Lev Gimelfarb wrote
David,
If you are not getting FirstName and LastName passed to stored procedure at all, then it means they cannot be retrieved from AD. Several scenarios when this can happen:
- DotNetNuke cannot access AD and uses failback mechanism (see DotNetNuke.Authentication.ADSIProvider source). But in this case it makes up FirstName and LastName based on the NTLM username.
- Expected fields are not received from AD. Check that "givenName" and "sn" exist for the user entry in AD. Can use any LDAP browser. (e.g. http://www.topshareware.com/LDAP-Browser-download-41756.htm).
Hope this helps
Lev
Lev,
Thanks for the info. I downloaded the LDAP browser and we were able to access AD. So I atleast know now that the server running DNN can access AD and we were able to verify that the givenName and sn fields were there and filled in properly. This leads me to believe that your first scenario is the problem and for some reason DNN itself can't access AD. Any ideas on what could be causing this and how to fix it? I'm also still getting the error that windows authentication is unavailable when ever I try to set it up through DNN and we've tried everything. Right now it's in a partial working state even though DNN says it's not available, users are getting auto logged in but we have to go into the database and fill in the name information. We also have another odd issue where one user keeps getting logged in as the server admin instead of himself. I'm starting to think somewhere along the line I borked something even though this is a fresh install and we haven't made any modifications to any of the code other then following the steps laid out here in the forums for trying to get windows auth working.
At this point I'm at a complete loss!
David
|
|
|
|
| |