Esempio n. 1
0
        public TfsUser GetTfsUser(string p)
        {
            Identity memberInfo = secSrv.ReadIdentity(SearchFactor.Sid, p, QueryMembership.Direct);

            if (memberInfo != null)
            {
                TfsUser usr = new TfsUser()
                {
                    SID         = memberInfo.Sid,
                    DisplayName = memberInfo.DisplayName,
                    Email       = memberInfo.MailAddress,
                    AccountName = memberInfo.AccountName
                };

                Identity[] gorupInfo = secSrv.ReadIdentities(SearchFactor.Sid, memberInfo.MemberOf, QueryMembership.None);
                foreach (Identity g in gorupInfo)
                {
                    usr.Roles.Add(g.DisplayName);
                }

                return(usr);
            }
            else
            {
                TfsUser usr = new TfsUser()
                {
                    SID         = p,
                    DisplayName = p
                };
                return(usr);
            }
        }
Esempio n. 2
0
        internal void Subscribe(TfsUser u, string tag, string eventType, string delType, string filter)
        {
            IEventService es = tpCollection.GetService(typeof(IEventService)) as IEventService;

            DeliveryPreference del = new DeliveryPreference();

            del.Schedule = DeliverySchedule.Immediate;
            del.Type     = (DeliveryType)Enum.Parse(typeof(DeliveryType), delType);
            del.Address  = u.Email;

            es.SubscribeEvent(u.SID, eventType, filter, del, tag);
        }
Esempio n. 3
0
        private TfsUser GetTfsUserFromList(string sidSubscriber, ref List <TfsUser> lstUser)
        {
            if (lstUser == null)
            {
                return(null);
            }
            else
            {
                TfsUser usr = (from u in lstUser where u.SID == sidSubscriber select u).FirstOrDefault();

                if (usr == null)
                {
                    usr = GetTfsUser(sidSubscriber);
                    lstUser.Add(usr);
                }

                return(usr);
            }
        }