Update to Timesheet/My Tasks Tied Mode Customization on CodePlex


Thanks to Steven Haden the Timesheet/My Tasks Tied-Mode customization has been updated to handle the case when a timesheet has been modified by a timesheet manager. I have updated the code on this solution (and converted the solution to Visual Studio 2008, and added a condition to handle a HTTPS configuration):

As a reminder CodePlex solution starter are community based projects and are not supported by Microsoft. Thus if you have feedback/enhancements you’d like to share with the community please do so!

New logic in STEP 3:

                #region STEP 3 - Perform statusing impersonation taking surrogate into account

                // Need to retrieve resource information to do proper impersonation
                ResourceWS.ResourceDataSet resourceDS = resource.ReadResource(tresUID);
                ResourcePSI resourcePSI = new ResourcePSI(resourceDS);

                // Check if surrogate timesheet
                if ((tsHeader.CreatorResUID != tsHeader.ResUID) // owner is different than creator
                    ||
                    (!resourcePSI.WindowsAccount.Equals(contextInfo.UserName))) // case where timesheet was modified by timesheet manager
                {
                    statusing.SetImpersonationContext(resourcePSI.IsWindowsUser, resourcePSI.WindowsAccount, tresUID, Guid.Empty, contextInfo.SiteGuid, contextInfo.Lcid);
                }
                else
                {
                    // Faster check that calling the resource web service
                    bool isWindowsUser = contextInfo.UserName.StartsWith("AspNetSqlMembershipProvider") ? false : true;
                    statusing.SetImpersonationContext(isWindowsUser, contextInfo.UserName, tresUID, Guid.Empty, contextInfo.SiteGuid, contextInfo.Lcid);
                }

old code use to be this:

                // Check if surrogate timesheet
                if (tsHeader.CreatorResUID != tsHeader.ResUID)
                {
                    // Need to retrieve resource information to do proper impersonation

                    ResourceWS.ResourceDataSet resourceDS = resource.ReadResource(tresUID);
                    ResourcePSI resourcePSI = new ResourcePSI(resourceDS);

                    statusing.SetImpersonationContext(resourcePSI.IsWindowsUser, resourcePSI.WindowsAccount, tresUID, Guid.Empty, contextInfo.SiteGuid, contextInfo.Lcid);
                }
                else
                {
                    // Faster check that calling the resource web service
                    bool isWindowsUser = contextInfo.UserName.StartsWith("AspNetSqlMembershipProvider") ? false : true;
                    statusing.SetImpersonationContext(isWindowsUser, contextInfo.UserName, tresUID, Guid.Empty, contextInfo.SiteGuid, contextInfo.Lcid);
                }
Skip to main content