Skip to content

Commit

Permalink
Revert "[BKNDLSS-23062] Java SDK. Methods for enabling/disabling users (
Browse files Browse the repository at this point in the history
#473)" (#477)

Revert "[BKNDLSS-23062] Java SDK. Methods for enabling/disabling users"
  • Loading branch information
ksv510 authored Nov 5, 2020
1 parent 2562f9d commit cc7829f
Showing 1 changed file with 0 additions and 60 deletions.
60 changes: 0 additions & 60 deletions src/com/backendless/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package com.backendless;

import com.backendless.async.callback.AsyncCallback;
import com.backendless.commons.user.UserStatusEnum;
import com.backendless.core.responder.AdaptingResponder;
import com.backendless.core.responder.policy.BackendlessUserAdaptingPolicy;
import com.backendless.exceptions.BackendlessException;
Expand All @@ -41,7 +40,6 @@

public final class UserService
{
private static final String USER_STATUS_COLUMN = "userStatus";
final static String USER_MANAGER_SERVER_ALIAS = "com.backendless.services.users.UserService";

private static BackendlessUser currentUser = new BackendlessUser();
Expand Down Expand Up @@ -417,26 +415,6 @@ public void handleFault( BackendlessFault fault )
}
}

public void enableUser( String userId )
{
changeUserStatus( userId, UserStatusEnum.ENABLED );
}

public void enableUser( String userId, AsyncCallback<Void> responder )
{
changeUserStatus( userId, UserStatusEnum.ENABLED, responder );
}

public void disableUser( String userId )
{
changeUserStatus( userId, UserStatusEnum.DISABLED );
}

public void disableUser( String userId, AsyncCallback<Void> responder )
{
changeUserStatus( userId, UserStatusEnum.DISABLED, responder );
}

public void restorePassword( String identity ) throws BackendlessException
{
if( identity == null )
Expand Down Expand Up @@ -844,44 +822,6 @@ public void isValidLogin( AsyncCallback<Boolean> responder )
}
}

private void changeUserStatus( String userId, UserStatusEnum newUserStatus ) throws BackendlessException
{
synchronized( currentUserLock )
{
Invoker.invokeSync( USER_MANAGER_SERVER_ALIAS, "changeUserStatus", new Object[] { userId, newUserStatus } );

if( currentUser != null && !currentUser.isEmpty() && currentUser.getObjectId().equals( userId ) )
currentUser.setProperty( USER_STATUS_COLUMN, newUserStatus.toString() );
}
}

private void changeUserStatus( final String userId, final UserStatusEnum newUserStatus, final AsyncCallback<Void> responder )
{
Invoker.invokeAsync(
USER_MANAGER_SERVER_ALIAS,
"changeUserStatus",
new Object[] { userId, newUserStatus },
new AsyncCallback<Void>()
{
@Override
public void handleResponse( Void response )
{
if( currentUser != null && !currentUser.isEmpty() && currentUser.getObjectId().equals( userId ) )
currentUser.setProperty( USER_STATUS_COLUMN, newUserStatus.toString() );

if( responder != null )
responder.handleResponse( response );
}

@Override
public void handleFault( BackendlessFault fault )
{
if( responder != null )
responder.handleFault( fault );
}
} );
}

private boolean isLogoutFaultAllowed( String errorCode )
{
return errorCode.equals( "3064" ) || errorCode.equals( "3091" ) || errorCode.equals( "3090" ) || errorCode.equals( "3023" );
Expand Down

0 comments on commit cc7829f

Please sign in to comment.