}
int authority = AuthorityUtil.getAuthority(null, viewerId);
page.setSize(listPhotoPageSize);
Album album = albumService.getAlbumById(albumId);
// 判断权限
if (album != null) {
int albumAuth = album.getAuthority();
if (authority < albumAuth) {
throw new NoVisitPermissionException("ID为:" + viewerId + "的用户没有访问ID为:"
+ album.getId() + "相册的权限");
}
} else {
throw new NoVisitPermissionException("ID:" + viewerId + "没有访问相册的权限");
}
List<Photo> photos = albumService.listPhotosOfAlbum(albumId, viewerId, authority, page,
addVisitCount);
ModelAndView mav = new ModelAndView(ViewPaths.ALBUM_VIEWALBUM);
mav.addObject("ownerId", album.getOwnerId());
mav.addObject("ownerName", album.getOwnerNickname());
mav.addObject("albumId", album.getId());
mav.addObject("page", page);
mav.addObject("photos", photos);
mav.addObject("album", album);
return mav;