feat: implement granular access revocation and global unsharing in the account permissions dialog
This commit is contained in:
@@ -40,6 +40,8 @@ interface AccountsContextType {
|
||||
switchAccount: (loginName: string) => Promise<void>;
|
||||
openSteamLogin: (steamId: string) => Promise<void>;
|
||||
shareAccountWithUser: (steamId: string, targetSteamId: string) => Promise<any>;
|
||||
revokeAccountAccess: (steamId: string, targetSteamId: string) => Promise<any>;
|
||||
revokeAllAccountAccess: (steamId: string) => Promise<any>;
|
||||
|
||||
// Server Methods
|
||||
updateServerConfig: (config: Partial<ServerConfig>) => Promise<void>;
|
||||
@@ -136,6 +138,18 @@ export const AccountsProvider: React.FC<{ children: React.ReactNode }> = ({ chil
|
||||
return res;
|
||||
};
|
||||
|
||||
const revokeAccountAccess = async (steamId: string, targetSteamId: string) => {
|
||||
const res = await (window as any).electronAPI.revokeAccountAccess(steamId, targetSteamId);
|
||||
await syncNow();
|
||||
return res;
|
||||
};
|
||||
|
||||
const revokeAllAccountAccess = async (steamId: string) => {
|
||||
const res = await (window as any).electronAPI.revokeAllAccountAccess(steamId);
|
||||
await syncNow();
|
||||
return res;
|
||||
};
|
||||
|
||||
const updateServerConfig = async (config: Partial<ServerConfig>) => {
|
||||
const updated = await (window as any).electronAPI.updateServerConfig(config);
|
||||
setServerConfig(updated);
|
||||
@@ -159,7 +173,7 @@ export const AccountsProvider: React.FC<{ children: React.ReactNode }> = ({ chil
|
||||
<AccountsContext.Provider value={{
|
||||
accounts, serverConfig, isLoading, isSyncing, addAccount, updateAccount, deleteAccount,
|
||||
switchAccount, openSteamLogin, updateServerConfig, loginToServer,
|
||||
getCommunityAccounts, getServerUsers, shareAccountWithUser, syncNow, refreshAccounts
|
||||
getCommunityAccounts, getServerUsers, shareAccountWithUser, revokeAccountAccess, revokeAllAccountAccess, syncNow, refreshAccounts
|
||||
}}>
|
||||
{children}
|
||||
</AccountsContext.Provider>
|
||||
|
||||
Reference in New Issue
Block a user