示例#1
0
 private void CopyMediaObject(IGalleryObject mediaObjectToCopy)
 {
     GalleryObjectController.CopyGalleryObject(mediaObjectToCopy, this.DestinationAlbum);
 }
示例#2
0
        // Note: Use the following version of UpdateRoleSecurityForMovedAlbum to enforce the rule that moved albums
        // must retain all role permissions it had in its original location, even inherited ones. This would go in
        // the Album class and be invoked from the MoveTo method.
        ///// <summary>
        ///// Validate that the moved album retains its original role permissions. If the role is inherited from
        ///// a parent album, then explicitly assign that role to the moved album. If the role is explicitly assigned to
        ///// the moved album, then check to see if the destination album already includes that role. If it does, there is
        ///// no need to apply it twice, so remove the explicitly assigned role from the moved album and let it simply
        ///// inherit the role.
        ///// </summary>
        ///// <param name="movedAlbum">The album that has just been moved to a new destination album.</param>
        //private void UpdateRoleSecurityForMovedAlbum(IAlbum movedAlbum)
        //{
        //  foreach (IGalleryServerRole role in this.GetGalleryServerRoles())
        //  {
        //    if (role.AllAlbumIds.Contains(movedAlbum.Id))
        //    {
        //      // This role applies to this object.
        //      if (role.RootAlbumIds.Contains(movedAlbum.Id))
        //      {
        //        // The album is directly specified in this role, but if any of this album's new parents are explicitly
        //        // specified, then it is not necessary to specify it at this level. Iterate through all the album's new
        //        // parent albums to see if this is the case.
        //        IAlbum albumToCheck = (IAlbum)movedAlbum.Parent;
        //        while (true)
        //        {
        //          if (role.RootAlbumIds.Contains(albumToCheck.Id))
        //          {
        //            role.RootAlbumIds.Remove(movedAlbum.Id);
        //            role.Save();
        //            break;
        //          }
        //          albumToCheck = (IAlbum)albumToCheck.Parent;

        //          if (albumToCheck.IsRootAlbum)
        //            break;
        //        }
        //      }
        //      else
        //      {
        //        // The album inherits its role from a parent. If the new parent is not included in this role,
        //        // then add this object so that the role permissions carry over to the new location.
        //        if (!role.AllAlbumIds.Contains(this.DestinationAlbum.Id))
        //        {
        //          role.RootAlbumIds.Add(movedAlbum.Id);
        //          role.Save();
        //        }
        //      }
        //    }
        //  }
        //}

        private void CopyAlbum(IAlbum albumToCopy)
        {
            GalleryObjectController.CopyGalleryObject(albumToCopy, this.DestinationAlbum);
        }