Esempio n. 1
0
        internal static async Task <OfaIdentity> GetIdentityAsync(string networkName)
        {
            var user = await ActiveDirectoryHelper.GetUserAsync(networkName);

            var directReports = await ActiveDirectoryHelper.GetDirectReportsAsync(networkName);

            var result = new OfaIdentity((IIdentity)user)
            {
                GivenName     = user.GivenName,
                Surname       = user.Surname,
                FullName      = user.DisplayName,
                Title         = user.Title,
                Department    = user.Department,
                PhoneNumber   = user.TelephoneNumber,
                EmailAddress  = user.Email,
                Manager       = PrincipalHelper.PrependDomain(user.ManagerNetworkName),
                DirectReports = directReports.Select(o => PrincipalHelper.PrependDomain(o.NetworkName)).ToCollection()
            };


            result.IsManager = result.DirectReports.Any();
            result.Roles     = user.MemberOf.ToCollection();

            return(result);
        }