public bool CanWatch(OCL.User AccessingUser) { if(AccessingUser.mvarIsSuperUser) { return true; } string sSQL = "Select IsVisible FROM tblGroupTokens WHERE ObjectTypeId = " + Convert.ToInt32(OCL.OysterObjectType.Recording) + " AND ObjectId = " + this.mvarID + " AND IsVisible <> 0" + " AND IsUsable <> 0"; OCL.Functions F = new OCL.Functions(); int numrecs = F.ExecuteNonQuery(sSQL); if(numrecs == 0) return false; else return true; }
/// <summary> /// Returns true or false if the AccessingUser Can Delete this recording from System /// </summary> /// <param name="AccessingUser"></param> /// <returns></returns> public bool CanDelete(OCL.User AccessingUser) { string sSQL = ""; if(AccessingUser.mvarIsSuperUser) { return true; } OCL.Functions F = new OCL.Functions(); OCL.RecordingSession RS = F.GetSession(this.SessionID); if(RS.OwnerID == AccessingUser.mvarID) return true; OCL.Group DefaultGroup = (OCL.Group)F.GetUnassignedObject(OCL.OysterUnassignedObjects.Group); sSQL = "Select IsVisible FROM tblGroupTokens WHERE DefaultGroup = " + DefaultGroup.ID + " AND UserId = " + AccessingUser.ID + " AND ObjectTypeId = " + Convert.ToInt32(OCL.OysterObjectType.Recording) + " AND ObjectId = " + this.mvarID + " AND IsVisible <> 0" + " AND CanDelete <> 0"; int numrecs = F.ExecuteNonQuery(sSQL); if(numrecs == 0) return false; else return true; }