Skip to content

Commit 7ef1b37

Browse files
author
serverpod_cloud
committed
feat: 5c89e661614d36b9dd24fa2f329d73c2220ed7a0
1 parent a6f4db2 commit 7ef1b37

2 files changed

Lines changed: 51 additions & 3 deletions

File tree

ground_control_client/lib/src/protocol/client.dart

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,49 @@ class EndpointProjects extends _i1.EndpointRef {
435435
'fetchProjectConfig',
436436
{'cloudProjectId': cloudProjectId},
437437
);
438+
439+
/// Attaches an existing user to a project by assigning the specified roles.
440+
///
441+
/// Throws [NotFoundException] if the user, project, or any of the roles
442+
/// do not exist.
443+
_i2.Future<void> attachUser({
444+
required String cloudProjectId,
445+
required String email,
446+
required List<String> assignRoleNames,
447+
}) =>
448+
caller.callServerEndpoint<void>(
449+
'projects',
450+
'attachUser',
451+
{
452+
'cloudProjectId': cloudProjectId,
453+
'email': email,
454+
'assignRoleNames': assignRoleNames,
455+
},
456+
);
457+
458+
/// Detaches an existing user from a project by removing the specified roles.
459+
/// If any of the roles do not exist or are not previously assigned to the
460+
/// user, they are simply ignored.
461+
/// If [unassignAllRoles] is true, all roles on the project are unassigned
462+
/// from the user.
463+
///
464+
/// Throws [NotFoundException] if the user or project does not exist.
465+
_i2.Future<void> detachUser({
466+
required String cloudProjectId,
467+
required String email,
468+
List<String>? unassignRoleNames,
469+
bool? unassignAllRoles,
470+
}) =>
471+
caller.callServerEndpoint<void>(
472+
'projects',
473+
'detachUser',
474+
{
475+
'cloudProjectId': cloudProjectId,
476+
'email': email,
477+
'unassignRoleNames': unassignRoleNames,
478+
'unassignAllRoles': unassignAllRoles,
479+
},
480+
);
438481
}
439482

440483
/// Endpoint for managing access roles.

ground_control_client/lib/src/protocol/protocol.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,21 @@ class Protocol extends _i1.SerializationManager {
445445
return (data as List).map((e) => deserialize<_i44.Project>(e)).toList()
446446
as T;
447447
}
448+
if (t == List<String>) {
449+
return (data as List).map((e) => deserialize<String>(e)).toList() as T;
450+
}
451+
if (t == _i1.getType<List<String>?>()) {
452+
return (data != null
453+
? (data as List).map((e) => deserialize<String>(e)).toList()
454+
: null) as T;
455+
}
448456
if (t == List<_i45.Role>) {
449457
return (data as List).map((e) => deserialize<_i45.Role>(e)).toList() as T;
450458
}
451459
if (t == Map<String, String>) {
452460
return (data as Map).map((k, v) =>
453461
MapEntry(deserialize<String>(k), deserialize<String>(v))) as T;
454462
}
455-
if (t == List<String>) {
456-
return (data as List).map((e) => deserialize<String>(e)).toList() as T;
457-
}
458463
if (t == List<_i46.DeployAttempt>) {
459464
return (data as List)
460465
.map((e) => deserialize<_i46.DeployAttempt>(e))

0 commit comments

Comments
 (0)