public String deleteScope ( String scopeName ) throws OAuthException { String responseMsg ; Scope foundScope = DBManagerFactory . getInstance ( ) . findScope ( scopeName ) . blockingGet ( ) ; if ( foundScope == null ) { LOG . error ( "scope does not exist" ) ; throw new OAuthException ( SCOPE_NOT_EXIST , HttpResponseStatus . BAD_REQUEST ) ; } else { // first, check whether there is a client app registered with that scope List < ApplicationInfo > registeredApps = getClientAppsByScope ( scopeName ) ; if ( registeredApps . size ( ) > 0 ) { responseMsg = SCOPE_USED_BY_APP_MESSAGE ; } else { boolean ok = DBManagerFactory . getInstance ( ) . deleteScope ( scopeName ) . blockingGet ( ) ; if ( ok ) { responseMsg = SCOPE_DELETED_OK_MESSAGE ; } else { responseMsg = SCOPE_DELETED_NOK_MESSAGE ; } } } return responseMsg ; }
Deletes a scope . If the scope does not exists returns an error .