agave-tags/tags-core/src/main/java/org/iplantc/service/tags/managers/TagPermissionManager.java
/**
	 * Checks for user ability to read the entity
	 * @param username
	 * @return
	 * @throws TagPermissionException
	 * @throws PermissionValidationException 
	 */
Checks for user ability to read the entity
@param username
@return
@throws TagPermissionException
@throws PermissionValidationException
Checks for user ability to read the entity @param username @return @throws TagPermissionException @throws PermissionValidationException
public boolean removeRead(String username) 
	throws TagPermissionException, PermissionValidationException 
	{
		if (tag == null) {
			throw new PermissionValidationException("No tag found for permission validation");
		}
		else if (StringUtils.isEmpty(username)) { 
			throw new PermissionValidationException("No username provided.");
		} 
		else if (AuthorizationHelper.isTenantAdmin(username) || isOwner(username)) {
			return false;
		} 
		else {
			TagPermission currentPem = getUserPermission(username);
			if (!currentPem.getPermission().canRead()) {
			} 
			else {
				PermissionType newPermissionType = currentPem.getPermission().subtract(PermissionType.READ);
				if (currentPem.getPermission() == PermissionType.NONE) {
					PermissionDao.delete(currentPem);
				} 
				else {
					currentPem.setPermission(newPermissionType);
					currentPem.setLastUpdated(new Timestamp(System.currentTimeMillis()));
					PermissionDao.persist(currentPem);
				}
				TagEventProcessor eventProcessor = new TagEventProcessor();
				try {
					eventProcessor.processPermissionEvent(tag, currentPem, 
							new TagEvent(tag.getUuid(), 
									TagEventType.PERMISSION_REVOKE, 
									"Read permission revoked to user " + username + " by user " + TenancyHelper.getCurrentEndUser(),
									TenancyHelper.getCurrentEndUser()));
				} catch (TagEventProcessingException e) {
					log.error("Failed to send read permission revoke event for tag " + tag.getUuid(), e);
				}
			}
			return true;
		}
	}
public boolean removeRead ( String username ) throws TagPermissionException , PermissionValidationException { if ( tag == null ) { throw new PermissionValidationException ( "No tag found for permission validation" ) ; } else if ( StringUtils . isEmpty ( username ) ) { throw new PermissionValidationException ( "No username provided." ) ; } else if ( AuthorizationHelper . isTenantAdmin ( username ) || isOwner ( username ) ) { return false ; } else { TagPermission currentPem = getUserPermission ( username ) ; if ( ! currentPem . getPermission ( ) . canRead ( ) ) { } else { PermissionType newPermissionType = currentPem . getPermission ( ) . subtract ( PermissionType . READ ) ; if ( currentPem . getPermission ( ) == PermissionType . NONE ) { PermissionDao . delete ( currentPem ) ; } else { currentPem . setPermission ( newPermissionType ) ; currentPem . setLastUpdated ( new Timestamp ( System . currentTimeMillis ( ) ) ) ; PermissionDao . persist ( currentPem ) ; } TagEventProcessor eventProcessor = new TagEventProcessor ( ) ; try { eventProcessor . processPermissionEvent ( tag , currentPem , new TagEvent ( tag . getUuid ( ) , TagEventType . PERMISSION_REVOKE , "Read permission revoked to user " + username + " by user " + TenancyHelper . getCurrentEndUser ( ) , TenancyHelper . getCurrentEndUser ( ) ) ) ; } catch ( TagEventProcessingException e ) { log . error ( "Failed to send read permission revoke event for tag " + tag . getUuid ( ) , e ) ; } } return true ; } }
Checks for user ability to read the entity
 @param username
 @return
 @throws TagPermissionException
 @throws PermissionValidationException
Checks for user ability to read the entity @param username @return @throws TagPermissionException @throws PermissionValidationException
// not much to do here. carry on // if they have an existing permissions, updated the timestamp