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); }
// 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"); }
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; }