Skip to main content

disableGroup

The disableGroup function allows to disable a group within the RBAC (Role-Based Access Control) system. This function returns a JSON object.

Parameters:

  • groupId (required): ID of the group to be disabled.

  • address (optional): address associated with the operation.

  • seed (optional): string representing the mnemonic seed.

Code example


import { Sdk } from "@peaq-network/sdk";

/**
* Disables a group within the RBAC system.
* @param {string} groupId - The ID of the group to be disabled (required).
* @param {Address} [address] - The address associated with the operation (not required).
* @param {string} [seed] - The mnemonic seed (not required).
* @returns {Promise<Object>} - A promise that resolves to an object containing a message field.
*/
const disableGroup = async (groupId, seed) => {
const sdkInstance = await Sdk.createInstance({
baseUrl: "wss://wsspc1-qa.agung.peaq.network",
seed,
});

try {
const result = await sdkInstance.rbac.disableGroup({
groupId,
});

return result;
} finally {
await sdkInstance.disconnect();
}
};

// Example usage
const groupId = "44759999-az06-2112-7130-b5kk4321";
const seed = "your-seed-phrase";

disableGroup(groupId)
.then((result) => {
console.log(result.message);
})
.catch((error) => {
console.error("Error disabling group:", error);
});



Response object


{
message: "Successfully disable group 02709409-kd01-4444-8222-b5zz8512"
}