taers232c / GAMADV-XTD3

Command line tool to manage Google Workspace
687 stars 86 forks source link

Add "not" mechanisms to established commands #401

Closed chromestrong closed 3 weeks ago

chromestrong commented 4 months ago

Adding a "NOT" mechanism would be very useful in GAM for the established commands.

For example (s):


NOT + domain

gam print users not domain example.com todrive
//this command would print all users that did not have an example.com suffix.

gam print aliases not domain example.com todrive
//this command would print all aliases that did not have an example.com suffix.

gam print addresses not domain example.com todrive
//this command would print all addresses that did not have an example.com suffix.

NOT + group
//this command option would print all accounts that were not a member of the given group

NOT + OUs
//this command option would print all accounts that were not a member of the given OU.

NOT + User
//this command option would print all accounts with the exception of the given user account.
chromestrong commented 4 months ago

If NOT is problematic then adding a bang "!" to the established commands is an option too.

gam print users !domain example.com todrive gam print aliases !domain example.com todrive gam print addresses !domain example.com todrive etc etc etc

taers232c commented 4 months ago

Eric,

The APIs have no support for these operations, you have to have GAM perform the filtering. See: https://github.com/taers232c/GAMADV-XTD3/wiki/CSV-Output-Filtering#column-row-filtering' https://github.com/taers232c/GAMADV-XTD3/wiki/CSV-Output-Filtering#column-row-filtering'

gam config csv_output_row_drop_filter "primaryEmail:regex:domain.com" print users

gam config csv_output_row_drop_filter "Alias:regex:domain.com" print aliases

gam config csv_output_row_drop_filter "Email:regex:domain.com" print addresses

gam config csv_output_row_drop_filter @.***$" all users print groups

gam config csv_output_row_drop_filter "orgUnitPath:regex:'/Test'" print users fields ou

gam config csv_output_row_drop_filter @.***$" print users

Ross

Ross Scroggs @.***

On Mar 4, 2024, at 6:57 AM, Eric @.***> wrote:

Adding a "NOT" mechanism would be very useful in GAM for the established commands.

For example (s):

NOT + domain

gam print users not domain example.com todrive //this command would print all users that did not have an example.com suffix.

gam print aliases not domain example.com todrive //this command would print all aliases that did not have an example.com suffix.

gam print addresses not domain example.com todrive //this command would print all addresses that did not have an example.com suffix.

NOT + group //this command option would print all accounts that were not a member of the given group

NOT + OUs //this command option would print all accounts that were not a member of the given OU.

NOT + User //this command option would print all accounts with the exception of the given user account.

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/401, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL5QFJRGKDLQNBHONJDYWSDXBAVCNFSM6AAAAABEFLLRSKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3DOMBUHA4TMOI. You are receiving this because you are subscribed to this thread.

chromestrong commented 4 months ago

Okay, I was just seeing if there was a way to incorporate that functionality without having to filter the csv output.

taers232c commented 4 months ago

Here's what the API supports: https://developers.google.com/admin-sdk/directory/v1/guides/search-users https://developers.google.com/admin-sdk/directory/v1/guides/search-users

Ross

Ross Scroggs @.***

On Mar 4, 2024, at 8:37 AM, Eric @.***> wrote:

Okay, I was just seeing if there was a way to incorporate that functionality without having to filter the csv output.

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/401#issuecomment-1977005665, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL6BODBEGXJIBY7UXB3YWSPLXAVCNFSM6AAAAABEFLLRSKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZXGAYDKNRWGU. You are receiving this because you commented.

chromestrong commented 4 months ago

I understand, but to make this simpler for the admin: Could the use of the not mechanisms be a shortcut to the csv filters that you have added outside of the API?

taers232c commented 4 months ago

No.

You can predefine the filters in gam.cfg and reference them on the command ine.

See: https://github.com/taers232c/GAMADV-XTD3/wiki/Meta-Commands-and-File-Redirection#select-output-filter-section https://github.com/taers232c/GAMADV-XTD3/wiki/Meta-Commands-and-File-Redirection#select-output-filter-section

[und] csv_output_row_drop_filter "primaryEmail:regex:domain.com http://domain.com/"

gam selectfilter und print users

Ross

Ross Scroggs @.***

On Mar 4, 2024, at 9:14 AM, Eric @.***> wrote:

I understand, but to make this simpler for the admin: Could the use of the not mechanisms be a shortcut to the csv filters that you have added outside of the API?

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/401#issuecomment-1977078780, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL554CXQSWZDJNNX5D3YWSTVVAVCNFSM6AAAAABEFLLRSKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZXGA3TQNZYGA. You are receiving this because you commented.

chromestrong commented 4 months ago

So the shortcut already exists, but its just not being used. Got it. Well that sucks.

taers232c commented 4 months ago

I'm not sure what you mean, sned me a Meet/Zoom invitation.

Ross

Ross Scroggs @.***

On Mar 4, 2024, at 9:57 AM, Eric @.***> wrote:

So the shortcut already exists, but its just not being used. Got it. Well that sucks.

— Reply to this email directly, view it on GitHub https://github.com/taers232c/GAMADV-XTD3/issues/401#issuecomment-1977154072, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACCTYL2W4RODUJCQDTBA5DTYWSYW7AVCNFSM6AAAAABEFLLRSKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZXGE2TIMBXGI. You are receiving this because you commented.