6.7 Remove Group Member

The removeGroupMember method is used to remove a member from the Group. Any existing member of the group can remove other members. The developer can choose to build stricter access-control mechanisms on top of this if desired (e.g. only the group-owner or group-admin is authorized to remove members from the group).

Method parameters :
  • parameters : Hashmap mapping groupId and companyEmployeeId, companyName of the employee you want to remove from the group.
  • success: Success block to be executed after member is removed from the group.
  • failure: Failure block to be executed if member could not be removed from the group, returns BayunError.

Java
Kotlin
String companyEmployeeId = "companyEmployeeId";
String companyName = "companyName";
String groupId = "groupId";

HashMap<String, String> parameters = new HashMap<>();
parameters.put("companyEmployeeId", companyEmployeeId);
parameters.put("companyName", companyName);
parameters.put("groupId", groupId);

// Callbacks to remove a member from a group
Handler.Callback success = new Handler.Callback() {
    @Override
    public boolean handleMessage(Message message) {
        Log.d(TAG, "Member removed successfully.");
        return false;
    }
}

Handler.Callback failure = new Handler.Callback() {
    @Override
    public boolean handleMessage(Message message) {
        String error = message.getData().getString("BayunError", "");
        if (error.equalsIgnoreCase(BayunError.ERROR_INTERNET_CONNECTION)) {

        } else if (error.equalsIgnoreCase(BayunError.ERROR_EMPLOYEE_DOESNT_BELONG_TO_GROUP)) {

        }
        return false; 
    }
};

bayunCore.removeGroupMember(parameters, success, failure);
val companyEmployeeId = "companyEmployeeId"
val companyName = "companyName"
val groupId = "groupId"

val parameters = HashMap<String, String>()
parameters["companyEmployeeId"] = companyEmployeeId
parameters["companyName"] = companyName
parameters["groupId"] = groupId

// Callbacks to remove a member from a group
val success = Handler.Callback {
    Log.d(TAG, "Member removed successfully.")
    false
}

val failure = Handler.Callback {
    val error = it.data.getString("BayunError", "")
    if (error == BayunError.ERROR_INTERNET_CONNECTION) {

    } else if (error == BayunError.ERROR_EMPLOYEE_DOESNT_BELONG_TO_GROUP) {

    }

    false
}

bayunCore.removeGroupMember(parameters, success, failure)

results matching ""

    No results matching ""