public static IsGroup ( string subject ) : bool | ||
subject | string | The subject to test. |
Результат | bool |
/// <summary> /// Retrieves the subjects that have ACL entries set for a namespace. /// </summary> /// <param name="nspace">The namespace (<c>null</c> for the root).</param> /// <returns>The subjects.</returns> public static SubjectInfo[] RetrieveSubjectsForNamespace(NamespaceInfo nspace) { string resourceName = Actions.ForNamespaces.ResourceMasterPrefix; if (nspace != null) { resourceName += nspace.Name; } AclEntry[] entries = SettingsProvider.AclManager.RetrieveEntriesForResource(resourceName); List <SubjectInfo> result = new List <SubjectInfo>(entries.Length); for (int i = 0; i < entries.Length; i++) { SubjectType type = AuthTools.IsGroup(entries[i].Subject) ? SubjectType.Group : SubjectType.User; // Remove the subject qualifier ('U.' or 'G.') string name = entries[i].Subject.Substring(2); if (result.Find(delegate(SubjectInfo x) { return(x.Name == name && x.Type == type); }) == null) { result.Add(new SubjectInfo(name, type)); } } return(result.ToArray()); }
/// <summary> /// Retrieves the subjects that have ACL entries set for a page. /// </summary> /// <param name="page">The page.</param> /// <returns>The subjects.</returns> public static SubjectInfo[] RetrieveSubjectsForPage(PageInfo page) { if (page == null) { throw new ArgumentNullException("page"); } AclEntry[] entries = SettingsProvider.AclManager.RetrieveEntriesForResource(Actions.ForPages.ResourceMasterPrefix + page.FullName); List <SubjectInfo> result = new List <SubjectInfo>(entries.Length); for (int i = 0; i < entries.Length; i++) { SubjectType type = AuthTools.IsGroup(entries[i].Subject) ? SubjectType.Group : SubjectType.User; // Remove the subject qualifier ('U.' or 'G.') string name = entries[i].Subject.Substring(2); if (result.Find(delegate(SubjectInfo x) { return(x.Name == name && x.Type == type); }) == null) { result.Add(new SubjectInfo(name, type)); } } return(result.ToArray()); }
/// <summary> /// Retrieves the subjects that have ACL entries set for a directory. /// </summary> /// <param name="provider">The provider.</param> /// <param name="directory">The directory.</param> /// <returns>The subjects.</returns> public SubjectInfo[] RetrieveSubjectsForDirectory(IFilesStorageProviderV40 provider, string directory) { if (provider == null) { throw new ArgumentNullException("provider"); } if (directory == null) { throw new ArgumentNullException("directory"); } if (directory.Length == 0) { throw new ArgumentException("Directory cannot be empty", "directory"); } AclEntry[] entries = _settingsProvider.AclManager.RetrieveEntriesForResource(Actions.ForDirectories.ResourceMasterPrefix + AuthTools.GetDirectoryName(provider, directory)); List <SubjectInfo> result = new List <SubjectInfo>(entries.Length); for (int i = 0; i < entries.Length; i++) { SubjectType type = AuthTools.IsGroup(entries[i].Subject) ? SubjectType.Group : SubjectType.User; // Remove the subject qualifier ('U.' or 'G.') string name = entries[i].Subject.Substring(2); if (result.Find(delegate(SubjectInfo x) { return(x.Name == name && x.Type == type); }) == null) { result.Add(new SubjectInfo(name, type)); } } return(result.ToArray()); }