/// <summary> /// Get a list of galleries the specified <paramref name="userName"/> can administer. Site administrators can view all /// galleries, while gallery administrators may have access to zero or more galleries. /// </summary> /// <param name="userName">Name of the user.</param> /// <returns> /// Returns an <see cref="IGalleryCollection"/> containing the galleries the current user can administer. /// </returns> public static IGalleryCollection GetGalleriesUserCanAdminister(string userName) { IGalleryCollection adminGalleries = new GalleryCollection(); foreach (IGalleryServerRole role in RoleController.GetGalleryServerRolesForUser(userName)) { if (role.AllowAdministerSite) { return Factory.LoadGalleries(); } else if (role.AllowAdministerGallery) { foreach (IGallery gallery in role.Galleries) { if (!adminGalleries.Contains(gallery)) { adminGalleries.Add(gallery); } } } } return adminGalleries; }
/// <summary> /// Gets a collection of all the galleries the specified <paramref name="userName" /> has access to. /// </summary> /// <param name="userName">Name of the user.</param> /// <returns>Returns an <see cref="IGalleryCollection" /> of all the galleries the specified <paramref name="userName" /> has access to.</returns> public static IGalleryCollection GetGalleriesForUser(string userName) { IGalleryCollection galleries = new GalleryCollection(); foreach (IGalleryServerRole role in RoleController.GetGalleryServerRolesForUser(userName)) { foreach (IGallery gallery in role.Galleries) { if (!galleries.Contains(gallery)) { galleries.Add(gallery); } } } return galleries; }