MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / removeFileOwner

Function removeFileOwner

storage/removeFileOwnerAcl.js:49–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 const storage = new Storage();
48
49 async function removeFileOwner() {
50 try {
51 // Removes the user from the access control list of the file. You can use
52 // deleteAllUsers(), deleteDomain(), deleteProject(), deleteGroup(), and
53 // deleteAllAuthenticatedUsers() to remove access for different types of entities.
54 await storage
55 .bucket(bucketName)
56 .file(fileName)
57 .acl.owners.deleteUser(userEmail);
58
59 console.log(`Removed user ${userEmail} from file ${fileName}.`);
60 } catch (error) {
61 console.error(
62 'Error executing remove file owner ACL:',
63 error.message || error
64 );
65 }
66 }
67
68 removeFileOwner();
69 // [END storage_remove_file_owner]

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected