Beispiel #1
0
        public void doGrant(IDatasetName idatasetName_0, string string_0, string string_1)
        {
            ISQLPrivilege idatasetName0 = idatasetName_0 as ISQLPrivilege;

            try
            {
                idatasetName0.Revoke(string_1, 1);
                idatasetName0.Revoke(string_1, 2);
                idatasetName0.Revoke(string_1, 4);
                idatasetName0.Revoke(string_1, 8);
            }
            catch
            {
            }
            string string0 = string_0;

            if (string0 != null)
            {
                if (string0 == "R")
                {
                    idatasetName0.Grant(string_1, 1, false);
                }
                else if (string0 == "RW")
                {
                    idatasetName0.Grant(string_1, 15, false);
                }
                else if (string0 != "NONE")
                {
                }
            }
        }
Beispiel #2
0
        public static bool isAllowedDatasetFC(string sLayer)
        {
            bool bRetVal = false;

            ESRI.ArcGIS.Geodatabase.IWorkspace pWorkSpace;
            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
            {
                pWorkSpace = oSpatialSubs.returnEditableSDEWorkspace();
            }

            if (pWorkSpace != null)
            {
                // get the feature classes from each dataset
                IEnumDataset enumFeatureDatasets = pWorkSpace.get_Datasets(esriDatasetType.esriDTFeatureDataset);
                enumFeatureDatasets.Reset();

                IFeatureDataset featureDataset = (IFeatureDataset)enumFeatureDatasets.Next();

                while (featureDataset != null)
                {
                    ISQLPrivilege oDSPriv = (ISQLPrivilege)featureDataset.FullName;
                    int           iDSPriv = oDSPriv.SQLPrivileges;

                    if (iDSPriv > 1)
                    {
                        IFeatureClassContainer fcContainer        = (IFeatureClassContainer)featureDataset;
                        IEnumFeatureClass      enumFeatureClasses = fcContainer.Classes;
                        enumFeatureClasses.Reset();
                        IFeatureClass fc = (IFeatureClass)enumFeatureClasses.Next();
                        while (fc != null)
                        {
                            if (sLayer == fc.AliasName.ToString())
                            {
                                bRetVal = true;
                                break;
                            }

                            fc = (IFeatureClass)enumFeatureClasses.Next();
                        }
                    }
                    featureDataset = (IFeatureDataset)enumFeatureDatasets.Next();
                }
            }
            return(bRetVal);
        }
Beispiel #3
0
        /// <summary>
        ///     Determines whether the connected user has the specificed privileges to the feature class.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="privilege">The privilege (values may be bitwise OR'd together if more than one privilege applies).</param>
        /// <returns>
        ///     Returns a <see cref="bool" /> representing <c>true</c> the privilage is supported; otherwise <c>false</c>
        /// </returns>
        public static bool HasPrivileges(this IFeatureClass source, esriSQLPrivilege privilege)
        {
            if (source == null)
            {
                return(false);
            }

            IDatasetName  datasetName  = source.FeatureDataset.FullName as IDatasetName;
            ISQLPrivilege sqlPrivilege = datasetName as ISQLPrivilege;

            if (sqlPrivilege == null)
            {
                return(false);
            }

            int supportedPrivileges = (int)privilege & sqlPrivilege.SQLPrivileges;

            return(supportedPrivileges > 0);
        }
Beispiel #4
0
        public static bool isAllowedStandaloneFC(string sLayer)
        {
            bool bRetVal = false;

            ESRI.ArcGIS.Geodatabase.IWorkspace pWorkSpace;

            using (CSpatialSubs oSpatialSubs = new CSpatialSubs())
            {
                pWorkSpace = oSpatialSubs.returnEditableSDEWorkspace();
            }

            if (pWorkSpace != null)
            {
                IEnumDataset enumFC = pWorkSpace.get_Datasets(esriDatasetType.esriDTFeatureClass);
                enumFC.Reset();

                IFeatureClass fc = (IFeatureClass)enumFC.Next();

                while (fc != null)
                {
                    IDataset      ds      = fc as IDataset;
                    ISQLPrivilege oFCPriv = (ISQLPrivilege)ds.FullName;

                    int iFCPriv = oFCPriv.SQLPrivileges;

                    if (iFCPriv > 1)
                    {
                        if (sLayer == fc.AliasName.ToString())
                        {
                            bRetVal = true;
                            break;
                        }

                        fc = (IFeatureClass)enumFC.Next();
                    }
                }
            }
            return(bRetVal);
        }