示例#1
0
        public static WhoAmI    whoAmI(this TMUser tmUser)
        {
            var whoAmI = new WhoAmI();

            if (tmUser.notNull())
            {
                whoAmI.UserName  = tmUser.UserName;
                whoAmI.UserId    = tmUser.UserID;
                whoAmI.GroupId   = tmUser.GroupID;
                whoAmI.GroupName = tmUser.userGroup().str();
                whoAmI.UserRoles = tmUser.userRoles().toStringArray().toList().join(",");
            }
            return(whoAmI);
        }
示例#2
0
        // Util Method
        public void Check_WhoAmIObject_for_Reader(TMUser tmUser, WhoAmI whoAmI)
        {
            Assert.IsNotNull(whoAmI);
            Assert.IsNotNull(whoAmI.UserName);
            Assert.Greater  (whoAmI.UserId , 0);
            Assert.Greater  (whoAmI.GroupId, 0);
            Assert.IsNotNull(whoAmI.GroupName);
            Assert.IsNotNull(whoAmI.UserRoles);

            Assert.AreEqual (whoAmI.UserName , tmUser.UserName);
            Assert.AreEqual (whoAmI.UserId   , tmUser.UserID);
            Assert.AreEqual (whoAmI.GroupId  , tmUser.GroupID);
            Assert.AreEqual (whoAmI.GroupName, "Reader");
            Assert.AreEqual (whoAmI.UserRoles, "ReadArticles , ReadArticlesTitles , ViewLibrary");
        }
示例#3
0
 public static WhoAmI whoAmI(this TMUser tmUser)
 {
     var whoAmI = new WhoAmI();
     if (tmUser.notNull())
     {
         whoAmI.UserName = tmUser.UserName;
         whoAmI.UserId = tmUser.UserID;
         whoAmI.GroupId = tmUser.GroupID;
         whoAmI.GroupName = tmUser.userGroup().str();
         whoAmI.UserRoles = tmUser.userRoles().toStringArray().toList().join(",");
     }
     return whoAmI;
 }