FogBugz Technical Support

A forum for technical support discussion related to Fogbugz.
The current FogBugz Knowledge Base can be found at http://help.fogcreek.com/fogbugz.

Posts by Fog Creek Employees are marked:

Documentation
Release Notes
Network Status

LDAP Name field workaround

I reviewed some of the previous threads on getting FB to use a different attribute in LDAP (Active Directory in our case) as the name field. In our organization (like others it seems) the Name attribute is the same as the cn or username.

As changing this in AD ran some potential risks, I came up with the following workaround (hack?) that updates the name via a trigger. It's been working great for us... YMMV. Thought I'd share with the community.

CREATE TRIGGER trigUpdateName ON Person
  AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON ;

IF UPDATE(sFullName)
BEGIN
  DECLARE @UserName NVARCHAR(50)
  SET @UserName=(SELECT  sFullName
                 FROM    INSERTED)
    -- See if this contains a username or full name
    IF (NOT (SELECT CHARINDEX(' ', @UserName) )>1)
      BEGIN
        DECLARE @FriendlyName NVARCHAR(50)
        SET @FriendlyName=(SELECT FIRST_NAME+' '+LAST_NAME
                          FROM  SOME_TABLE
                          WHERE  USERNAME=@UserName)

        IF (@UserName IS NOT NULL) -- Update to friendly name
          BEGIN
            UPDATE  Person
            SET      sFullName=@FriendlyName
            WHERE    sFullName=@UserName
          END
        ELSE -- Just in case there is a problem getting the full name
          BEGIN
            UPDATE  Person
            SET      sFullName=@UserName+' '
            WHERE    sFullName=@UserName
          END

        END
    END
  END
GO
Michael Stormoen Send private email
Tuesday, October 13, 2009
 
 
Oops, that should have been
IF (@FriendlyName IS NOT NULL) -- Update to friendly name
Michael Stormoen Send private email
Tuesday, October 13, 2009
 
 
Hi Michael-
Neat. Thank you!
Brett
Brett Kiefer Send private email
Thursday, October 15, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz Bug Tracking and Evidence-Based Scheduling.