示例#1
0
        internal object GetAllGroupObjectsWithPermission(OCL.User AccessingUser,
			OCL.OysterObjectType OBT, OCL.OysterPermissions OP)
        {
            string sSQL = "SELECT DISTINCT ObjectId FROM tblGroupTokens WHERE UserId = " + AccessingUser.ID +
                " AND ObjectTypeId = " + Convert.ToInt32(OBT) +
                " AND " + GetPermissionColumnName(OP) + " = " + Convert.ToInt32(OP);

            DataSet DS = RF.GetDataSet(sSQL);

            if(DS.Tables[0].Rows.Count == 0)
                return null;

            switch(OBT)
            {
                case OCL.OysterObjectType.User:
                    OCL.Users US = new OCL.Users();
                    foreach(DataRow R in DS.Tables[0].Rows)
                    {
                        US.Add(GetUser(Convert.ToInt32(R[0])));
                    }
                    return US;
                case OCL.OysterObjectType.Recording:
                    OCL.Recordings RS = new OCL.Recordings();
                    foreach(DataRow R in DS.Tables[0].Rows)
                    {

                        RS.Add(GetRecording(Convert.ToInt32(R[0])));
                    }
                    return RS;
                case OCL.OysterObjectType.Control:
                    OCL.Controls XS = new OCL.Controls();
                    foreach(DataRow R in DS.Tables[0].Rows)
                    {

                        XS.Add(GetControl(Convert.ToInt32(R[0])));
                    }
                    return XS;
                case OCL.OysterObjectType.Source:
                    OCL.Sources S = new OCL.Sources();
                    foreach(DataRow R in DS.Tables[0].Rows)
                    {
                        S.Add(GetSource(Convert.ToInt32(R[0])));
                    }
                    return S;
                case OCL.OysterObjectType.Scene:
                    OCL.Scenes SS = new OCL.Scenes();
                    foreach(DataRow R in DS.Tables[0].Rows)
                    {
                        SS.Add(GetScene(Convert.ToInt32(R[0])));
                    }
                    return SS;
                case OCL.OysterObjectType.Note:
                    OCL.Notes N = new OCL.Notes();
                    foreach(DataRow R in DS.Tables[0].Rows)
                    {
                        N.Add(GetNote(Convert.ToInt32(R[0])));
                    }
                    return N;
                default:
                    return null;
            }
        }
示例#2
0
        /// <summary>
        /// Get all visible users of AccessingUser that have visible access 
        /// to TargetRecordingSession within TargetGroup
        /// </summary>
        /// <param name="AccessingUser"></param>
        /// <param name="TargetRecordingSession"></param>
        /// <returns>OCL.Users</returns>
        internal OCL.Users AllUsersWithVisibleAccessToRecordingSession(OCL.User AccessingUser, OCL.RecordingSession TargetRecordingSession, OCL.Group TargetGroup)
        {
            string sSQL = "";

            if(AccessingUser.mvarIsSuperUser)
            {

                sSQL = "SELECT DISTINCT tblGroupTokens.ObjectId, tblUser.Name FROM tblGroupTokens left outer join tblUser " +
                    "ON tblUser.Id = tblGroupTokens.ObjectId " +
                    " WHERE GroupId = " + TargetGroup.mvarID +
                    " AND ObjectTypeId = " + Convert.ToInt32(OCL.OysterObjectType.User) +
                    " AND tblUser.IsDefault = 0 " +
                    " AND tblUser.IsPublicAccess = 0" +
                    " ORDER BY tblUser.Name";
            }
            else
            {

                sSQL = "SELECT DISTINCT ObjectId, tblUser.Name FROM tblGroupTokens left outer join tblUser " +
                    "ON tblUser.Id = tblGroupTokens.ObjectId " +
                    " WHERE GroupId = " + TargetGroup.mvarID +
                    " AND ObjectTypeId = " + Convert.ToInt32(OCL.OysterObjectType.User) +
                    " AND IsVisible <> 0" +
                    " AND tblUser.IsDefault = 0" +
                    " AND tblUser.IsPublicAccess = 0" +
                    " ORDER BY tblUser.Name";

            }
            System.Data.DataSet DS = RF.GetDataSet(sSQL);
            OCL.Users AVS = new OCL.Users();

            if(DS.Tables[0].Rows.Count > 0)
            {
                foreach(DataRow r in DS.Tables[0].Rows)
                {
                    AVS.Add(GetUser(Convert.ToInt32(r[0])));
                }
            }
            return AVS;
        }