internal Users All_Users(OCL.Group QueryGroup, OCL.User AccessingUser, OysterPermissions OPT) { try { string ColumnName = GetPermissionColumnName(OPT); Users X = new Users(); OCL.User DU = (OCL.User)GetUnassignedObject(OCL.OysterUnassignedObjects.User); string sSQL = ""; if(AccessingUser.mvarIsSuperUser) sSQL = "SELECT DISTINCT UserId FROM tblGroupTokens WHERE GroupId = " + QueryGroup.ID + " AND UserId <> " + DU.ID; else sSQL = "SELECT DISTINCT ObjectId FROM tblGroupTokens WHERE GroupId = " + QueryGroup.ID + " AND UserId = " + AccessingUser.ID + " AND ObjectTypeId = " + Convert.ToInt32(OysterObjectType.User) + " AND ObjectId <> " + DU.ID + " AND " + ColumnName + " <> 0"; DataSet DS = RF.GetDataSet(sSQL); foreach(DataRow r in DS.Tables[0].Rows) { int UserID = Convert.ToInt32(r[0]); User U = GetUser(UserID); X.Add(U); } return X; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }
internal Users ALLVisibleUsers(OCL.User AccessingUser, string SearchCriteria) { Users X = new Users(); string sSQL = ""; OCL.User DU = (OCL.User)GetUnassignedObject(OCL.OysterUnassignedObjects.User); if((AccessingUser.CanSeeAllUsers)||(AccessingUser.mvarIsSuperUser)) { string sParsedSearchCriteria = BuildAdvancedSearchString("Name",SearchCriteria); if(sParsedSearchCriteria == string.Empty) { sSQL = "SELECT Id from tblUser WHERE Id <> " + DU.ID + " AND Name <> 'System Administrator'" + " AND IsPublicAccess = 0 " + "ORDER BY Name"; } else { sSQL = "SELECT Id from tblUser WHERE " + sParsedSearchCriteria + " AND Id <> " + DU.ID + " AND Name <> 'System Administrator'" + " AND IsPublicAccess = 0 " + "ORDER BY Name"; } } else { string sParsedSearchCriteria = BuildAdvancedSearchString("u.Name",SearchCriteria); OCL.Group DG = (OCL.Group)GetUnassignedObject(OCL.OysterUnassignedObjects.Group); if(sParsedSearchCriteria == string.Empty) { sSQL = "SELECT DISTINCT gt.ObjectId, u.Name FROM tblGroupTokens gt left outer join tblUser u ON " + "u.Id = gt.ObjectId WHERE gt.GroupId = " + DG.ID + " AND gt.UserId = " + AccessingUser.ID + " AND gt.ObjectTypeId = " + Convert.ToInt32(OCL.OysterObjectType.User) + " AND gt.ObjectId <> " + DU.ID + " AND gt.IsVisible <> 0" + " AND IsPublicAccess = 0 " + " ORDER BY u.Name"; } else { sSQL = "SELECT DISTINCT gt.ObjectId, u.Name FROM tblGroupTokens gt left outer join tblUser u ON " + "u.Id = gt.ObjectId WHERE " + sParsedSearchCriteria + " AND gt.GroupId = " + DG.ID + " AND gt.UserId = " + AccessingUser.ID + " AND gt.ObjectTypeId = " + Convert.ToInt32(OCL.OysterObjectType.User) + " AND gt.ObjectId <> " + DU.ID + " AND gt.IsVisible <> 0" + " AND IsPublicAccess = 0 " + " ORDER BY u.Name"; } } try { DataSet DS = RF.GetDataSet(sSQL); foreach(DataRow r in DS.Tables[0].Rows) { int UserID = Convert.ToInt32(r[0]); User U = GetUser(UserID); X.Add(U); } return X; } catch(Exception Err) { throw new ApplicationException(Err.Message); } }