agave-systems/systems-core/src/main/java/org/iplantc/service/systems/manager/SystemManager.java
/**
     * Sets the system availability to false and notifies subscribers
     * @param system the system to make available
     * @param createdBy user who made the request
     * @return the updated system
     */
Sets the system availability to false and notifies subscribers
@param system the system to make available
@param createdBy user who made the request
@return the updated system
Sets the system availability to false and notifies subscribers @param system the system to make available @param createdBy user who made the request @return the updated system
public RemoteSystem disableSystem(RemoteSystem system, String createdBy) 
    throws SystemException, PermissionException
    {
    	if (StringUtils.equalsIgnoreCase(createdBy, Settings.PUBLIC_USER_USERNAME) ||
    			StringUtils.equalsIgnoreCase(createdBy, Settings.WORLD_USER_USERNAME)) {
    		throw new PermissionException("Permission denied. Public users may not manage systems.");
    	}
    	else if (system.isPubliclyAvailable() && !ServiceUtils.isAdmin(createdBy)) {
            throw new PermissionException("Permission denied. Only tenant administrators may disable public systems.");
        }
        else if (!system.getUserRole(createdBy).canAdmin()) {
            throw new PermissionException("Permission denied. Only users with the ADMIN role may disable this system.");
        }
        else 
        {
            if (!system.isAvailable()) {
                throw new SystemException(system.getSystemId() + " is already disabled.");
            } else {
                system.setAvailable(false);
                getDao().persist(system);
                getEventProcessor().processSystemUpdateEvent(system, SystemEventType.DISABLED, createdBy);
                return system;
            }
        }
    }
public RemoteSystem disableSystem ( RemoteSystem system , String createdBy ) throws SystemException , PermissionException { if ( StringUtils . equalsIgnoreCase ( createdBy , Settings . PUBLIC_USER_USERNAME ) || StringUtils . equalsIgnoreCase ( createdBy , Settings . WORLD_USER_USERNAME ) ) { throw new PermissionException ( "Permission denied. Public users may not manage systems." ) ; } else if ( system . isPubliclyAvailable ( ) && ! ServiceUtils . isAdmin ( createdBy ) ) { throw new PermissionException ( "Permission denied. Only tenant administrators may disable public systems." ) ; } else if ( ! system . getUserRole ( createdBy ) . canAdmin ( ) ) { throw new PermissionException ( "Permission denied. Only users with the ADMIN role may disable this system." ) ; } else { if ( ! system . isAvailable ( ) ) { throw new SystemException ( system . getSystemId ( ) + " is already disabled." ) ; } else { system . setAvailable ( false ) ; getDao ( ) . persist ( system ) ; getEventProcessor ( ) . processSystemUpdateEvent ( system , SystemEventType . DISABLED , createdBy ) ; return system ; } } }
Sets the system availability to false and notifies subscribers
 @param system the system to make available
 @param createdBy user who made the request
 @return the updated system
Sets the system availability to false and notifies subscribers @param system the system to make available @param createdBy user who made the request @return the updated system