@linagora/ldap-rest-client 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/index.d.mts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +3 -2
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,9 @@ client.organizations.listUsers(orgId, { page, limit, status, search, sortBy, sor
|
|
|
100
100
|
client.organizations.checkUserAvailability(orgId, { field, value })
|
|
101
101
|
|
|
102
102
|
// User role management ('owner', 'admin', 'moderator', 'member')
|
|
103
|
-
|
|
103
|
+
// Returns { role, previousRole }
|
|
104
|
+
const result = await client.organizations.changeUserRole(orgId, userId, { role })
|
|
105
|
+
console.log(`Changed from ${result.previousRole} to ${result.role}`)
|
|
104
106
|
|
|
105
107
|
// Technical/service accounts in organizations
|
|
106
108
|
const techUser = await client.organizations.createUser(orgId, { ...userData, isTechnical: true })
|
package/dist/index.d.mts
CHANGED
|
@@ -667,6 +667,15 @@ interface ChangeUserRoleRequest {
|
|
|
667
667
|
/** New role for the user */
|
|
668
668
|
role: OrganizationRole;
|
|
669
669
|
}
|
|
670
|
+
/**
|
|
671
|
+
* Response from changing a user's role in an organization
|
|
672
|
+
*/
|
|
673
|
+
interface ChangeUserRoleResponse {
|
|
674
|
+
/** The new role assigned to the user */
|
|
675
|
+
role: OrganizationRole;
|
|
676
|
+
/** The user's previous role before the change */
|
|
677
|
+
previousRole: OrganizationRole;
|
|
678
|
+
}
|
|
670
679
|
/**
|
|
671
680
|
* Organization owner information
|
|
672
681
|
*/
|
|
@@ -1312,21 +1321,20 @@ declare class OrganizationsResource extends BaseResource {
|
|
|
1312
1321
|
* @param {string} organizationId - Organization identifier
|
|
1313
1322
|
* @param {string} userId - User identifier (username)
|
|
1314
1323
|
* @param {ChangeUserRoleRequest} data - New role
|
|
1315
|
-
* @returns {Promise<
|
|
1324
|
+
* @returns {Promise<ChangeUserRoleResponse>} Response containing the new role and previous role
|
|
1316
1325
|
* @throws {NotFoundError} When user or organization is not found
|
|
1317
1326
|
* @throws {ForbiddenError} When attempting self-demotion or removing last admin
|
|
1318
1327
|
* @throws {ApiError} On other API errors
|
|
1319
1328
|
*
|
|
1320
1329
|
* @example
|
|
1321
1330
|
* ```typescript
|
|
1322
|
-
* await client.organizations.changeUserRole('org_abc123', 'john.doe', {
|
|
1331
|
+
* const result = await client.organizations.changeUserRole('org_abc123', 'john.doe', {
|
|
1323
1332
|
* role: 'moderator'
|
|
1324
1333
|
* });
|
|
1334
|
+
* console.log(`Changed role from ${result.previousRole} to ${result.role}`);
|
|
1325
1335
|
* ```
|
|
1326
1336
|
*/
|
|
1327
|
-
changeUserRole: (organizationId: string, userId: string, data: ChangeUserRoleRequest) => Promise<
|
|
1328
|
-
success: true;
|
|
1329
|
-
}>;
|
|
1337
|
+
changeUserRole: (organizationId: string, userId: string, data: ChangeUserRoleRequest) => Promise<ChangeUserRoleResponse>;
|
|
1330
1338
|
}
|
|
1331
1339
|
|
|
1332
1340
|
/**
|
|
@@ -1713,4 +1721,4 @@ declare class NetworkError extends LdapRestError {
|
|
|
1713
1721
|
constructor(message: string, cause?: Error);
|
|
1714
1722
|
}
|
|
1715
1723
|
|
|
1716
|
-
export { type AddGroupMembersRequest, type Address, ApiError, AuthenticationError, AuthorizationError, type ChangeUserRoleRequest, type CheckAvailabilityParams, type CheckAvailabilityResponse, type CheckOrganizationAvailabilityParams, type ClientConfig, ConflictError, type CreateAdminRequest, type CreateB2BUserResponse, type CreateGroupRequest, type CreateOrganizationRequest, type CreateOrganizationResponse, type CreateUserRequest, type EmailAddress, type ExtendedAddress, type FetchUserRequest, type GeoLocation, type GetOwnerResponse, type Group, GroupsResource, type InstantMessaging, LdapRestClient, LdapRestError, type ListGroupsParams, type ListGroupsResponse, type ListUsersParams, type ListUsersResponse, NetworkError, NotFoundError, type Organization, type OrganizationMetadata, type OrganizationOwner, type OrganizationRole, type OrganizationSearchField, type OrganizationStatus, OrganizationsResource, type PhoneNumber, RateLimitError, type SetOwnerRequest, type TransferOwnershipRequest, type UpdateGroupRequest, type UpdateOrganizationRequest, type UpdateUserRequest, type User, type UserCredentials, type UserKeys, type UserName, type UserSearchField, type UserStatus, UsersResource, ValidationError };
|
|
1724
|
+
export { type AddGroupMembersRequest, type Address, ApiError, AuthenticationError, AuthorizationError, type ChangeUserRoleRequest, type ChangeUserRoleResponse, type CheckAvailabilityParams, type CheckAvailabilityResponse, type CheckOrganizationAvailabilityParams, type ClientConfig, ConflictError, type CreateAdminRequest, type CreateB2BUserResponse, type CreateGroupRequest, type CreateOrganizationRequest, type CreateOrganizationResponse, type CreateUserRequest, type EmailAddress, type ExtendedAddress, type FetchUserRequest, type GeoLocation, type GetOwnerResponse, type Group, GroupsResource, type InstantMessaging, LdapRestClient, LdapRestError, type ListGroupsParams, type ListGroupsResponse, type ListUsersParams, type ListUsersResponse, NetworkError, NotFoundError, type Organization, type OrganizationMetadata, type OrganizationOwner, type OrganizationRole, type OrganizationSearchField, type OrganizationStatus, OrganizationsResource, type PhoneNumber, RateLimitError, type SetOwnerRequest, type TransferOwnershipRequest, type UpdateGroupRequest, type UpdateOrganizationRequest, type UpdateUserRequest, type User, type UserCredentials, type UserKeys, type UserName, type UserSearchField, type UserStatus, UsersResource, ValidationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -667,6 +667,15 @@ interface ChangeUserRoleRequest {
|
|
|
667
667
|
/** New role for the user */
|
|
668
668
|
role: OrganizationRole;
|
|
669
669
|
}
|
|
670
|
+
/**
|
|
671
|
+
* Response from changing a user's role in an organization
|
|
672
|
+
*/
|
|
673
|
+
interface ChangeUserRoleResponse {
|
|
674
|
+
/** The new role assigned to the user */
|
|
675
|
+
role: OrganizationRole;
|
|
676
|
+
/** The user's previous role before the change */
|
|
677
|
+
previousRole: OrganizationRole;
|
|
678
|
+
}
|
|
670
679
|
/**
|
|
671
680
|
* Organization owner information
|
|
672
681
|
*/
|
|
@@ -1312,21 +1321,20 @@ declare class OrganizationsResource extends BaseResource {
|
|
|
1312
1321
|
* @param {string} organizationId - Organization identifier
|
|
1313
1322
|
* @param {string} userId - User identifier (username)
|
|
1314
1323
|
* @param {ChangeUserRoleRequest} data - New role
|
|
1315
|
-
* @returns {Promise<
|
|
1324
|
+
* @returns {Promise<ChangeUserRoleResponse>} Response containing the new role and previous role
|
|
1316
1325
|
* @throws {NotFoundError} When user or organization is not found
|
|
1317
1326
|
* @throws {ForbiddenError} When attempting self-demotion or removing last admin
|
|
1318
1327
|
* @throws {ApiError} On other API errors
|
|
1319
1328
|
*
|
|
1320
1329
|
* @example
|
|
1321
1330
|
* ```typescript
|
|
1322
|
-
* await client.organizations.changeUserRole('org_abc123', 'john.doe', {
|
|
1331
|
+
* const result = await client.organizations.changeUserRole('org_abc123', 'john.doe', {
|
|
1323
1332
|
* role: 'moderator'
|
|
1324
1333
|
* });
|
|
1334
|
+
* console.log(`Changed role from ${result.previousRole} to ${result.role}`);
|
|
1325
1335
|
* ```
|
|
1326
1336
|
*/
|
|
1327
|
-
changeUserRole: (organizationId: string, userId: string, data: ChangeUserRoleRequest) => Promise<
|
|
1328
|
-
success: true;
|
|
1329
|
-
}>;
|
|
1337
|
+
changeUserRole: (organizationId: string, userId: string, data: ChangeUserRoleRequest) => Promise<ChangeUserRoleResponse>;
|
|
1330
1338
|
}
|
|
1331
1339
|
|
|
1332
1340
|
/**
|
|
@@ -1713,4 +1721,4 @@ declare class NetworkError extends LdapRestError {
|
|
|
1713
1721
|
constructor(message: string, cause?: Error);
|
|
1714
1722
|
}
|
|
1715
1723
|
|
|
1716
|
-
export { type AddGroupMembersRequest, type Address, ApiError, AuthenticationError, AuthorizationError, type ChangeUserRoleRequest, type CheckAvailabilityParams, type CheckAvailabilityResponse, type CheckOrganizationAvailabilityParams, type ClientConfig, ConflictError, type CreateAdminRequest, type CreateB2BUserResponse, type CreateGroupRequest, type CreateOrganizationRequest, type CreateOrganizationResponse, type CreateUserRequest, type EmailAddress, type ExtendedAddress, type FetchUserRequest, type GeoLocation, type GetOwnerResponse, type Group, GroupsResource, type InstantMessaging, LdapRestClient, LdapRestError, type ListGroupsParams, type ListGroupsResponse, type ListUsersParams, type ListUsersResponse, NetworkError, NotFoundError, type Organization, type OrganizationMetadata, type OrganizationOwner, type OrganizationRole, type OrganizationSearchField, type OrganizationStatus, OrganizationsResource, type PhoneNumber, RateLimitError, type SetOwnerRequest, type TransferOwnershipRequest, type UpdateGroupRequest, type UpdateOrganizationRequest, type UpdateUserRequest, type User, type UserCredentials, type UserKeys, type UserName, type UserSearchField, type UserStatus, UsersResource, ValidationError };
|
|
1724
|
+
export { type AddGroupMembersRequest, type Address, ApiError, AuthenticationError, AuthorizationError, type ChangeUserRoleRequest, type ChangeUserRoleResponse, type CheckAvailabilityParams, type CheckAvailabilityResponse, type CheckOrganizationAvailabilityParams, type ClientConfig, ConflictError, type CreateAdminRequest, type CreateB2BUserResponse, type CreateGroupRequest, type CreateOrganizationRequest, type CreateOrganizationResponse, type CreateUserRequest, type EmailAddress, type ExtendedAddress, type FetchUserRequest, type GeoLocation, type GetOwnerResponse, type Group, GroupsResource, type InstantMessaging, LdapRestClient, LdapRestError, type ListGroupsParams, type ListGroupsResponse, type ListUsersParams, type ListUsersResponse, NetworkError, NotFoundError, type Organization, type OrganizationMetadata, type OrganizationOwner, type OrganizationRole, type OrganizationSearchField, type OrganizationStatus, OrganizationsResource, type PhoneNumber, RateLimitError, type SetOwnerRequest, type TransferOwnershipRequest, type UpdateGroupRequest, type UpdateOrganizationRequest, type UpdateUserRequest, type User, type UserCredentials, type UserKeys, type UserName, type UserSearchField, type UserStatus, UsersResource, ValidationError };
|
package/dist/index.js
CHANGED
|
@@ -1072,16 +1072,17 @@ var OrganizationsResource = class extends BaseResource {
|
|
|
1072
1072
|
* @param {string} organizationId - Organization identifier
|
|
1073
1073
|
* @param {string} userId - User identifier (username)
|
|
1074
1074
|
* @param {ChangeUserRoleRequest} data - New role
|
|
1075
|
-
* @returns {Promise<
|
|
1075
|
+
* @returns {Promise<ChangeUserRoleResponse>} Response containing the new role and previous role
|
|
1076
1076
|
* @throws {NotFoundError} When user or organization is not found
|
|
1077
1077
|
* @throws {ForbiddenError} When attempting self-demotion or removing last admin
|
|
1078
1078
|
* @throws {ApiError} On other API errors
|
|
1079
1079
|
*
|
|
1080
1080
|
* @example
|
|
1081
1081
|
* ```typescript
|
|
1082
|
-
* await client.organizations.changeUserRole('org_abc123', 'john.doe', {
|
|
1082
|
+
* const result = await client.organizations.changeUserRole('org_abc123', 'john.doe', {
|
|
1083
1083
|
* role: 'moderator'
|
|
1084
1084
|
* });
|
|
1085
|
+
* console.log(`Changed role from ${result.previousRole} to ${result.role}`);
|
|
1085
1086
|
* ```
|
|
1086
1087
|
*/
|
|
1087
1088
|
changeUserRole = async (organizationId, userId, data) => {
|
package/dist/index.mjs
CHANGED
|
@@ -1034,16 +1034,17 @@ var OrganizationsResource = class extends BaseResource {
|
|
|
1034
1034
|
* @param {string} organizationId - Organization identifier
|
|
1035
1035
|
* @param {string} userId - User identifier (username)
|
|
1036
1036
|
* @param {ChangeUserRoleRequest} data - New role
|
|
1037
|
-
* @returns {Promise<
|
|
1037
|
+
* @returns {Promise<ChangeUserRoleResponse>} Response containing the new role and previous role
|
|
1038
1038
|
* @throws {NotFoundError} When user or organization is not found
|
|
1039
1039
|
* @throws {ForbiddenError} When attempting self-demotion or removing last admin
|
|
1040
1040
|
* @throws {ApiError} On other API errors
|
|
1041
1041
|
*
|
|
1042
1042
|
* @example
|
|
1043
1043
|
* ```typescript
|
|
1044
|
-
* await client.organizations.changeUserRole('org_abc123', 'john.doe', {
|
|
1044
|
+
* const result = await client.organizations.changeUserRole('org_abc123', 'john.doe', {
|
|
1045
1045
|
* role: 'moderator'
|
|
1046
1046
|
* });
|
|
1047
|
+
* console.log(`Changed role from ${result.previousRole} to ${result.role}`);
|
|
1047
1048
|
* ```
|
|
1048
1049
|
*/
|
|
1049
1050
|
changeUserRole = async (organizationId, userId, data) => {
|