@Test @Parameters public void testTakeSnapshot(final AccessControlList acl, User user, final boolean assertAccess) throws Exception { createSnapshot(acl, user, assertAccess); }
@Override public Snapshot takeSnapshot(String owner, MediaPackage mp) { final String mediaPackageId = mp.getIdentifier().toString(); final boolean firstSnapshot = !snapshotExists(mediaPackageId); if (firstSnapshot) { deleteProperties(mediaPackageId); } if (firstSnapshot || isAuthorized(mediaPackageId, WRITE_ACTION)) { final Snapshot snapshot = super.takeSnapshot(owner, mp); final AccessControlList acl = authSvc.getActiveAcl(mp).getA(); storeAclAsProperties(snapshot, acl); return snapshot; } return chuck(new UnauthorizedException("Not allowed to take snapshot of media package " + mediaPackageId)); }
AssetManagerWithSecurity extends AssetManagerDecorator<TieredStorageAssetManager> { @Override public Snapshot takeSnapshot(String owner, MediaPackage mp) { final String mediaPackageId = mp.getIdentifier().toString(); final boolean firstSnapshot = !snapshotExists(mediaPackageId); if (firstSnapshot) { deleteProperties(mediaPackageId); } if (firstSnapshot || isAuthorized(mediaPackageId, WRITE_ACTION)) { final Snapshot snapshot = super.takeSnapshot(owner, mp); final AccessControlList acl = authSvc.getActiveAcl(mp).getA(); storeAclAsProperties(snapshot, acl); return snapshot; } return chuck(new UnauthorizedException("Not allowed to take snapshot of media package " + mediaPackageId)); } }
AssetManagerWithSecurity extends AssetManagerDecorator<TieredStorageAssetManager> { @Override public Snapshot takeSnapshot(String owner, MediaPackage mp) { final String mediaPackageId = mp.getIdentifier().toString(); final boolean firstSnapshot = !snapshotExists(mediaPackageId); if (firstSnapshot) { deleteProperties(mediaPackageId); } if (firstSnapshot || isAuthorized(mediaPackageId, WRITE_ACTION)) { final Snapshot snapshot = super.takeSnapshot(owner, mp); final AccessControlList acl = authSvc.getActiveAcl(mp).getA(); storeAclAsProperties(snapshot, acl); return snapshot; } return chuck(new UnauthorizedException("Not allowed to take snapshot of media package " + mediaPackageId)); } AssetManagerWithSecurity(
      TieredStorageAssetManager delegate,
      AuthorizationService authSvc,
      SecurityService secSvc,
      final boolean includeAPIRoles,
      final boolean includeCARoles,
      final boolean includeUIRoles); }
AssetManagerWithSecurity extends AssetManagerDecorator<TieredStorageAssetManager> { @Override public Snapshot takeSnapshot(String owner, MediaPackage mp) { final String mediaPackageId = mp.getIdentifier().toString(); final boolean firstSnapshot = !snapshotExists(mediaPackageId); if (firstSnapshot) { deleteProperties(mediaPackageId); } if (firstSnapshot || isAuthorized(mediaPackageId, WRITE_ACTION)) { final Snapshot snapshot = super.takeSnapshot(owner, mp); final AccessControlList acl = authSvc.getActiveAcl(mp).getA(); storeAclAsProperties(snapshot, acl); return snapshot; } return chuck(new UnauthorizedException("Not allowed to take snapshot of media package " + mediaPackageId)); } AssetManagerWithSecurity(
      TieredStorageAssetManager delegate,
      AuthorizationService authSvc,
      SecurityService secSvc,
      final boolean includeAPIRoles,
      final boolean includeCARoles,
      final boolean includeUIRoles); @Override Snapshot takeSnapshot(String owner, MediaPackage mp); @Override void setAvailability(Version version, String mpId, Availability availability); @Override boolean setProperty(Property property); @Override Opt<Asset> getAsset(Version version, String mpId, String mpElementId); @Override AQueryBuilder createQuery(); @Override List<Property> selectProperties(final String mediaPackageId, String namespace); }
AssetManagerWithSecurity extends AssetManagerDecorator<TieredStorageAssetManager> { @Override public Snapshot takeSnapshot(String owner, MediaPackage mp) { final String mediaPackageId = mp.getIdentifier().toString(); final boolean firstSnapshot = !snapshotExists(mediaPackageId); if (firstSnapshot) { deleteProperties(mediaPackageId); } if (firstSnapshot || isAuthorized(mediaPackageId, WRITE_ACTION)) { final Snapshot snapshot = super.takeSnapshot(owner, mp); final AccessControlList acl = authSvc.getActiveAcl(mp).getA(); storeAclAsProperties(snapshot, acl); return snapshot; } return chuck(new UnauthorizedException("Not allowed to take snapshot of media package " + mediaPackageId)); } AssetManagerWithSecurity(
      TieredStorageAssetManager delegate,
      AuthorizationService authSvc,
      SecurityService secSvc,
      final boolean includeAPIRoles,
      final boolean includeCARoles,
      final boolean includeUIRoles); @Override Snapshot takeSnapshot(String owner, MediaPackage mp); @Override void setAvailability(Version version, String mpId, Availability availability); @Override boolean setProperty(Property property); @Override Opt<Asset> getAsset(Version version, String mpId, String mpElementId); @Override AQueryBuilder createQuery(); @Override List<Property> selectProperties(final String mediaPackageId, String namespace); static final String WRITE_ACTION; static final String READ_ACTION; static final String SECURITY_NAMESPACE; }