API to fetch users who have read/write permission on a document collection (#5047)
This commit is contained in:
@@ -159,6 +159,25 @@ export default class UsersStore extends BaseStore<User> {
|
||||
return res.data;
|
||||
};
|
||||
|
||||
@action
|
||||
fetchDocumentUsers = async (params: {
|
||||
id: string;
|
||||
query?: string;
|
||||
}): Promise<User[]> => {
|
||||
try {
|
||||
const res = await client.post("/documents.users", params);
|
||||
invariant(res?.data, "User list not available");
|
||||
let response: User[] = [];
|
||||
runInAction("DocumentsStore#fetchUsers", () => {
|
||||
response = res.data.map(this.add);
|
||||
this.addPolicies(res.policies);
|
||||
});
|
||||
return response;
|
||||
} catch (err) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
};
|
||||
|
||||
@action
|
||||
async delete(user: User, options: Record<string, any> = {}) {
|
||||
super.delete(user, options);
|
||||
|
||||
Reference in New Issue
Block a user