if ( Contexts.isSessionContextActive() ) {
Identity.instance().checkPermission( new PackageNameType( asset.metaData.packageName ),
RoleTypes.PACKAGE_READONLY );
if ( asset.metaData.categories.length == 0 ) {
Identity.instance().checkPermission( new CategoryPathType( null ),
RoleTypes.ANALYST_READ );
} else {
boolean passed = false;
RuntimeException exception = null;
for ( String cat : asset.metaData.categories ) {
// Check if user has a permission to read this asset.
try {
Identity.instance().checkPermission( new CategoryPathType( cat ),
RoleTypes.ANALYST_READ );
passed = true;
} catch ( RuntimeException e ) {
exception = e;
}