1.0.2 • Published 11 months ago

delete-permission-google-script v1.0.2

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
11 months ago

Script for remove permissions

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Russian:

Для работы скрипта необходимо выполнить следующие действия:

Создать проект в Google Cloud Console и включить в нем Google Drive API.

Создать учетную запись сервисного аккаунта, создать в разделе "manage keys" ключ и скачать файл с ключом доступа.

поместить ключ доступа по пути keys//adminKey.json и переименовать в соответствующее название

Дать сервисному аккаунту доступ к диску, будь то папка или конкретный файл, для чего во вкладке поделиться доступом по email вести email этого сервисного аккаунта, который можно найти в его настройках в Google Cloud Console

Установить библиотеку googleapis: npm install googleapis.

Запустить скрипт: node deletePermission.js с нужными аргументами.

При запуске скрипта в аргументах консоли необходимо ввести ссылку на ресурс и email пользователя, для которого нужно удалить пермишн. Если указанный пользователь не имеет доступа к ресурсу, скрипт выведет соответствующее сообщение. При успешном выполнении скрипт выведет сообщение об успешном удалении пермишна.

node delete_permission.js https://docs.google.com/spreadsheets/d/1Q5mMX48koyy2cMPXFe_4U_h4-ddMSfrnC-_wi8vDtTM/edit?usp=drive_link Shilko_VI_20@mf.grsu.by

для работы в качестве npm модуля:

повторить вышеуказанные действия

установить модуль:

npm install delete-permissions-google-script

подключить библиотеку и использовать функцию:

const delete_permission = require('delete-permissions-google-script')
delete_permission(targetUrl, emailAdress)

English:

For the script to work, you need permission to act:

Create a project in the Google Cloud Console and enable the Google Drive API in it.

Create a service account, create a key in the "manage keys" section and download the file with the access key.

Give a service account access to a drive, whether it be a folder or a specific file, to do this, enable email sharing to keep the email of this service account, which can be found in the Google Cloud Console

Install googleapis library: npm install googleapis.

Run script: node deletePermission.js with required arguments.

When resolving the script in the console arguments, you must enter the permission to the resource and the email address of the user for whom you want to remove the permission. If the specified user does not have access to the resource, the script will display the associated message. Upon successful execution, the script will display a message about the successful removal of the permission.

node delete_permission.js https://docs.google.com/spreadsheets/d/1Q5mMX48koyy2cMPXFe_4U_h4-ddMSfrnC-_wi8vDtTM/edit?usp=drive_link Shilko_VI_20@mf.grsu.by

to work as an npm module:

repeat the above steps

install module:

npm install delete-permissions-google-script

connect the library and use the function:

const delete_permission = require('delete-permissions-google-script')
delete_permission(targetUrl, emailAddress)

Authors

  • Shilko Vladimir

Visit https://developers.google.com for more information

License

No license, just deal with it

Acknowledgments

  • Hat tip to anyone whose code was used
  • Inspiration
  • etc
1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago