Code Monkey home page Code Monkey logo

gws's Introduction

gws - command line tool to use the Google Workspace Admin SDK

Build Status

features

  • list of users
  • details of a user
  • membership of a user
  • management of groups
  • list of roles
  • user assignments of a role
  • list of domains

Any command can produce JSON format using -json at the end of the command.

examples

gws user list
gws user list -limit 4
gws user membership john.doe
gws user membership [email protected]
gws user info john.doe
gws user info [email protected]
gws user aliases [email protected]
gws user suspend angelina "retired"

gws group list    
gws group members all
gws group members [email protected]

gws group info somegroup
gws group info [email protected]
gws group delete [email protected]
gws group delete [email protected]
gws group add my-group this-person [email protected]
gws group remove my-group this-person
gws group export -json > all.json    
gws --domain company.com group export -csv > company-only.csv

gws role list
gws role assignments _USER_MANAGEMENT_ADMIN_ROLE

gws domain list

gws examples

requirements

primary domain access

If your Google Workspace (GSuite) account only has "Group Editor" role then you cannot use the short syntax for accounts that require the lookup of the primary domain. You can workaround this missing permission by setting an enviroment variable such as:

export GWS_PRIMARY_DOMAIN=yourhost.com

install

Installation requires the Go SDK.

go install github.com/emicklei/gws@latest 

tool authentication

  • Using the Google Cloud Platform console, create a new OAuth 2.0 client ID credential in the project for which you enabled the Admin SDK.
  • Download the JSON file from the list of Credentials (download button on the right).
  • Save the file to gws-credentials.json in your home directory or a local directory if you need access to more organisations. gws will look for this file in the current directoy first.

user permissions

gws requires the following authentication scopes to be consent per user. You will be asked to accept those on the first time you use gws. Note that accepting these scopes does not mean you as a user have access ; this is controlled in Cloud Identity (or Google Workspace/GSuite) Admin Console.

See also https://developers.google.com/admin-sdk/directory/v1/guides/authorizing

help

Having problems using gws ? Read about known errors

© 2023+, ernestmicklei.com. MIT License. Contributions welcome.

gws's People

Contributors

dependabot[bot] avatar emicklei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ahlfors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.