mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-06 23:31:38 +00:00
Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a70bbf08ed | ||
|
|
57e1625246 | ||
|
|
24bd99386b | ||
|
|
e1f8969352 | ||
|
|
76aa1d1cdd | ||
|
|
7bdee0927a | ||
|
|
b18d8a0107 | ||
|
|
5ed5540746 | ||
|
|
0a9ea7fc83 | ||
|
|
7ece7a0a1a | ||
|
|
8d9f5689f3 | ||
|
|
8cd378ff8f | ||
|
|
c0e037dda5 | ||
|
|
b5730aadce | ||
|
|
4ec58bb844 | ||
|
|
3ba99582dc | ||
|
|
b61a4f5115 | ||
|
|
7ce83b4623 | ||
|
|
a58a998b49 | ||
|
|
4e04bd7c51 | ||
|
|
779ac0a6a0 | ||
|
|
f18b7258bb | ||
|
|
d4932c9d39 | ||
|
|
352845e482 | ||
|
|
ff49c67580 | ||
|
|
efee86cd33 |
15
.github/workflows/build.yml
vendored
15
.github/workflows/build.yml
vendored
@@ -5,6 +5,7 @@ on:
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '37 22 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -17,7 +18,7 @@ defaults:
|
||||
working-directory: src
|
||||
|
||||
env:
|
||||
SCRATCH_COUNTER: 7
|
||||
SCRATCH_COUNTER: 9
|
||||
OPENSSL_CONFIG_OPTS: no-fips --api=3.0.0
|
||||
OPENSSL_INSTALL_PATH: ${{ github.workspace }}/bin/ssl
|
||||
OPENSSL_SOURCE_PATH: ${{ github.workspace }}/src/openssl
|
||||
@@ -756,7 +757,7 @@ jobs:
|
||||
|
||||
- name: Attest that gam package files were generated from this Action
|
||||
uses: actions/attest-build-provenance@v1
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule') && matrix.goal == 'build'
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.goal == 'build'
|
||||
with:
|
||||
subject-path: |
|
||||
gam*.tar.xz
|
||||
@@ -765,7 +766,7 @@ jobs:
|
||||
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule') && matrix.goal != 'test'
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.goal != 'test'
|
||||
with:
|
||||
name: gam-binaries-${{ env.GAMOS }}-${{ env.arch }}-${{ matrix.jid }}
|
||||
path: |
|
||||
@@ -793,8 +794,8 @@ jobs:
|
||||
fi
|
||||
echo "We successfully compiled Python ${this_python} and OpenSSL ${this_openssl}"
|
||||
|
||||
- name: Live API tests push only
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule')
|
||||
- name: Live API tests
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
|
||||
run: |
|
||||
export gam_user="gam-gha-${JID}@pdl.jaylee.us"
|
||||
echo "gam_user=${gam_user}" >> $GITHUB_ENV
|
||||
@@ -1004,7 +1005,7 @@ jobs:
|
||||
tar cJvvf cache.tar.xz $tar_folders
|
||||
|
||||
merge:
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule')
|
||||
if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
|
||||
runs-on: ubuntu-24.04
|
||||
needs: build
|
||||
permissions:
|
||||
@@ -1018,7 +1019,7 @@ jobs:
|
||||
pattern: gam-binaries-*
|
||||
|
||||
publish:
|
||||
if: github.event_name == 'push'
|
||||
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
|
||||
runs-on: ubuntu-24.04
|
||||
needs: merge
|
||||
permissions:
|
||||
|
||||
33
.github/workflows/pypi.yml
vendored
Normal file
33
.github/workflows/pypi.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: build and publish releases to PyPi
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
pypi:
|
||||
name: Upload release to PyPI
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/p/gam7
|
||||
permissions:
|
||||
id-token: write
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install required packages to publish
|
||||
run: |
|
||||
python3 -m pip install --upgrade build
|
||||
|
||||
- name: Build packages
|
||||
run: |
|
||||
python -m build
|
||||
|
||||
- name: Publish package distributions to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
63
pyproject.toml
Normal file
63
pyproject.toml
Normal file
@@ -0,0 +1,63 @@
|
||||
[project]
|
||||
name = "gam7"
|
||||
dynamic = [
|
||||
"version",
|
||||
]
|
||||
authors = [
|
||||
{ name="Jay Lee", email="jay0lee@gmail.com" },
|
||||
{ name="Ross Scroggs", email="Ross.Scroggs@gmail.com" },
|
||||
]
|
||||
dependencies = [
|
||||
"chardet",
|
||||
"cryptography",
|
||||
"distro; sys_platform=='linux'",
|
||||
"filelock",
|
||||
"google-api-python-client>=2.1",
|
||||
"google-auth-httplib2",
|
||||
"google-auth-oauthlib>=0.4.1",
|
||||
"google-auth>=2.3.2",
|
||||
"httplib2>=0.17.0",
|
||||
"lxml",
|
||||
"passlib>=1.7.2",
|
||||
"pathvalidate",
|
||||
"python-dateutil",
|
||||
]
|
||||
description = "CLI tool to manage Google Workspace"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.9"
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
license = {text = "Apache License (2.0)"}
|
||||
license-files = ["LICEN[CS]E*"]
|
||||
|
||||
[project.optional-dependencies]
|
||||
yubikey = ["yubikey-manager>=5.0"]
|
||||
|
||||
[project.scripts]
|
||||
gam = "gam.__main__:main"
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/GAM-team/GAM"
|
||||
Issues = "https://github.com/GAM-team/GAM/issues"
|
||||
Discussion = "https://groups.google.com/group/google-apps-manager"
|
||||
Chat = "https://git.io/gam-chat"
|
||||
|
||||
[tool.hatch.version]
|
||||
path = "src/gam/__init__.py"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/gam"]
|
||||
|
||||
[build-system]
|
||||
requires = [
|
||||
"hatchling",
|
||||
]
|
||||
build-backend = "hatchling.build"
|
||||
@@ -2090,19 +2090,25 @@ gam move browsers ou|org|orgunit <OrgUnitPath>
|
||||
[batchsize <Integer>]
|
||||
|
||||
gam info browser <DeviceID>
|
||||
[basic|full|annotated] <BrowserFieldName>* [fields <BrowserFieldNameList>]
|
||||
(basic|full|annotated |
|
||||
(<BrowserFieldName>* [fields <BrowserFieldNameList>]) |
|
||||
(rawfields "<BrowserFieldNameList>"))
|
||||
[formatjson]
|
||||
gam show browsers
|
||||
([ou|org|orgunit|browserou <OrgUnitPath>] [(query <QueryBrowser>)|(queries <QueryBrowserList>))|(select <BrowserEntity>))
|
||||
[querytime<String> <Time>]
|
||||
[orderby <BrowserOrderByFieldName> [ascending|descending]]
|
||||
[basic|full|allfields|annotated] <BrowserFieldName>* [fields <BrowserFieldNameList>]
|
||||
(basic|full|annotated |
|
||||
(<BrowserFieldName>* [fields <BrowserFieldNameList>]) |
|
||||
(rawfields "<BrowserFieldNameList>"))
|
||||
[formatjson]
|
||||
gam print browsers [todrive <ToDriveAttribute>*]
|
||||
([ou|org|orgunit|browserou <OrgUnitPath>] [(query <QueryBrowser>)|(queries <QueryBrowserList>))|(select <BrowserEntity>))
|
||||
[querytime<String> <Time>]
|
||||
[orderby <BrowserOrderByFieldName> [ascending|descending]]
|
||||
[basic|full|allfields|annotated] <BrowserFieldName>* [fields <BrowserFieldNameList>]
|
||||
(basic|full|annotated |
|
||||
(<BrowserFieldName>* [fields <BrowserFieldNameList>]) |
|
||||
(rawfields "<BrowserFieldNameList>"))
|
||||
[sortheaders]
|
||||
[formatjson [quotechar <Character>]]
|
||||
|
||||
@@ -4736,41 +4742,6 @@ gam <UserTypeEntity> sendemail from <EmailAddress>
|
||||
[newuser <EmailAddress> firstname|givenname <String> lastname|familyname <string> password <Password>]
|
||||
(<SMTPDateHeader> <Time>)* (<SMTPHeader> <String>)* (header <String> <String>)*
|
||||
|
||||
# Sites
|
||||
|
||||
<SiteACLRole> ::= editor|owner|reader|writer
|
||||
<SiteACLRoleList> ::= "<SiteACLRole>(,<SiteACLRole>)*"
|
||||
|
||||
<SiteACLScope> ::=
|
||||
<EmailAddress>|user:<EmailAddress>|group:<EmailAddress>|domain:<DomainName>|domain|default
|
||||
<SiteACLScopeList> ::= "<SiteACLScope>(,<SiteACLScope>)*"
|
||||
<SiteACLScopeEntity> ::=
|
||||
<SiteACLScopeList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
|
||||
|
||||
<SiteAttribute> ::=
|
||||
(categories <String>)|
|
||||
(name <String>)|
|
||||
(sourcelink <URI>])|
|
||||
(summary <String>)|
|
||||
(theme <String>)
|
||||
|
||||
gam [<UserTypeEntity>] create|add site <SiteItem> <SiteAttribute>*
|
||||
gam [<UserTypeEntity>] update sites <SiteEntity> <SiteAttribute>+
|
||||
gam [<UserTypeEntity>] info sites <SiteEntity> [withmappings] [role|roles all|<SiteACLRoleList>]
|
||||
gam [<UserTypeEntity>] show sites [domain|domains <DomainNameEntity>] [includeallsites]
|
||||
[withmappings] [role|roles all|<SiteACLRoleList>] [startindex <Number>] [maxresults <Number>]
|
||||
gam [<UserTypeEntity>] print sites [todrive <ToDriveAttribute>*] [domain|domains <DomainNameEntity>] [includeallsites]
|
||||
[withmappings] [role|roles all|<SiteACLRoleList>] [startindex <Number>] [maxresults <Number>] [convertcrnl] [delimiter <Character>]
|
||||
|
||||
gam [<UserTypeEntity>] print siteactivity <SiteEntity> [todrive <ToDriveAttribute>*] [startindex <Number>] [maxresults <Number>] [updated_min <Date>] [updated_max <Date>]
|
||||
|
||||
gam [<UserTypeEntity>] create|add siteacls <SiteEntity> <SiteACLRole> <SiteACLScopeEntity>
|
||||
gam [<UserTypeEntity>] update siteacls <SiteEntity> <SiteACLRole> <SiteACLScopeEntity>
|
||||
gam [<UserTypeEntity>] delete siteacls <SiteEntity> <SiteACLScopeEntity>
|
||||
gam [<UserTypeEntity>] info siteacls <SiteEntity> <SiteACLScopeEntity>
|
||||
gam [<UserTypeEntity>] show siteacls <SiteEntity>
|
||||
gam [<UserTypeEntity>] print siteacls <SiteEntity> [todrive <ToDriveAttribute>*]
|
||||
|
||||
# Shared Drives - Administrator
|
||||
|
||||
<SharedDriveFieldName> ::=
|
||||
@@ -5264,7 +5235,7 @@ gam print vaultcounts [todrive <ToDriveAttributes>*]
|
||||
gam print vaultcounts [todrive <ToDriveAttributes>*]
|
||||
matter <MatterItem> operation <String> [wait <Integer>]
|
||||
|
||||
gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|mail|groups|hangouts_chat|voice
|
||||
gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|gemini|groups|hangouts_chat|mail|voice
|
||||
(accounts <EmailAddressEntity>) | (orgunit|org|ou <OrgUnitPath>) | everyone
|
||||
(shareddrives|teamdrives <SharedDriveIDList>) | (rooms <RoomList>) | (sitesurl <URLList>)
|
||||
[scope all_data|held_data|unprocessed_data]
|
||||
@@ -5272,10 +5243,12 @@ gam create vaultexport|export matter <MatterItem> [name <String>] corpus calenda
|
||||
[locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>]
|
||||
[responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>]
|
||||
[includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
|
||||
[driveclientsideencryption any|encrypted|unencrypted]
|
||||
[includerooms <Boolean>]
|
||||
[excludedrafts <Boolean>] [format mbox|pst]
|
||||
[excludedrafts <Boolean>] [mailclientsideencryption any|encrypted|unencrypted]
|
||||
[showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>] [exportlinkeddrivefiles <Boolean>]
|
||||
[covereddata calllogs|textmessages|voicemails]
|
||||
[format ics|mbox|pst|xml]
|
||||
[region any|europe|us] [showdetails|returnidonly]
|
||||
gam delete vaultexport|export <ExportItem> matter <MatterItem>
|
||||
gam delete vaultexport|export <MatterItem> <ExportItem>
|
||||
@@ -7598,6 +7571,7 @@ gam <UserTypeEntity> show messages|threads
|
||||
[countsonly|positivecountsonly] [useronly]
|
||||
[headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
|
||||
[showlabels] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
|
||||
[maxmessagesperthread <Number>]
|
||||
[[attachmentnamepattern <RegularExpression>]
|
||||
[showattachments [noshowtextplain]]
|
||||
[saveattachments [targetfolder <FilePath>] [overwrite [<Boolean>]]]
|
||||
@@ -7609,6 +7583,7 @@ gam <UserTypeEntity> print messages|threads [todrive <ToDriveAttribute>*]
|
||||
[countsonly|positivecountsonly] [useronly]
|
||||
[headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String> [dateheaderconverttimezone [<Boolean>]]]
|
||||
[showlabels] [delimiter <Character>] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
|
||||
[maxmessagesperthread <Number>]
|
||||
[convertcrnl] [delimiter <Character>]
|
||||
[[attachmentnamepattern <RegularExpression>]
|
||||
[showattachments [noshowtextplain]]]
|
||||
|
||||
@@ -1,9 +1,95 @@
|
||||
7.04.02
|
||||
|
||||
Improved output formatting for the following commands:
|
||||
```
|
||||
gam info peoplecontact
|
||||
gam show peoplecontacts
|
||||
gam info peopleprofile
|
||||
gam show peopleprofile
|
||||
gam <UserTypeEntity> info contacts
|
||||
gam <UserTypeEntity> show contacts
|
||||
gam <UserTypeEntity> show peopleprofile
|
||||
```
|
||||
|
||||
7.04.01
|
||||
|
||||
Fixed bug where multiple `querytime<String>` values in a query were not properly processed;
|
||||
only the last `querytime<String>` was processed.
|
||||
```
|
||||
Command line: query "sync:#querytime1#..#querytime2# status:provisioned" querytime1 -2y querytime2 -40w
|
||||
Query: (sync:#querytime1#..2024-05-09T00:00:00 status:provisioned) Invalid
|
||||
```
|
||||
|
||||
7.04.00
|
||||
|
||||
The Classic Sites API no longer functions, the following commands are deprecated:
|
||||
```
|
||||
gam [<UserTypeEntity>] create site
|
||||
gam [<UserTypeEntity>] update site
|
||||
gam [<UserTypeEntity>] info site
|
||||
gam [<UserTypeEntity>] print sites
|
||||
gam [<UserTypeEntity>] show sites
|
||||
gam [<UserTypeEntity>] create siteacls
|
||||
gam [<UserTypeEntity>] update siteacls
|
||||
gam [<UserTypeEntity>] delete siteacls
|
||||
gam [<UserTypeEntity>] info siteacls
|
||||
gam [<UserTypeEntity>] show siteacls
|
||||
gam [<UserTypeEntity>] print siteacls
|
||||
gam [<UserTypeEntity>] print siteactivity
|
||||
```
|
||||
|
||||
7.03.09
|
||||
|
||||
Added option `maxmessagesperthread <Number>` to `gam <UserTypeEntity> print|show threads`
|
||||
that limits the number of messages displayed per thread. The default is 0, there is no limit.
|
||||
For example, this can be used if you only want to see the first message of each thread.
|
||||
```
|
||||
gam user user@domain.com print|show threads maxmessagesperthread 1
|
||||
```
|
||||
|
||||
Fixed bug in `gam <UserTypeEntity> print filelist countsonly` where extraneous columns
|
||||
were displayed.
|
||||
|
||||
Fixed bug in `gam <UserTypeEntity> print filelist countsonly showsize` where sizes were
|
||||
all shown as 0 unless`sizefield size` was specified.
|
||||
|
||||
7.03.08
|
||||
|
||||
Improved pip install.
|
||||
|
||||
Yubikey as optional should now be working also. So:
|
||||
|
||||
pip install --upgrade gam7
|
||||
|
||||
skips Yubikey.
|
||||
|
||||
To install with yubikey support (assuming you have installed the necessary swig and libpcsclite-dev packages already) run:
|
||||
|
||||
pip install --upgrade gam7[yubikey]
|
||||
|
||||
7.03.07
|
||||
|
||||
Updated `gam create vaultexport` to include `corpus gemini`.
|
||||
|
||||
* See: https://workspaceupdates.googleblog.com/2025/02/google-vault-now-supports-gemini.html
|
||||
|
||||
7.03.06
|
||||
|
||||
Added option `rawfields "<BrowserFieldNameList>"` to `gam info|print|show browsers` that allows
|
||||
specification of complex field lists with selected subfields.
|
||||
|
||||
* See: https://github.com/GAM-team/GAM/wiki/Chrome-Browser-Cloud-Management#raw-fields
|
||||
|
||||
7.03.05
|
||||
|
||||
Make GAM pip-installable: "pip install gam7"
|
||||
|
||||
7.03.04
|
||||
|
||||
Added option `security` to `gam create cigroup` that allows creation of a security group
|
||||
in a single command.
|
||||
|
||||
Updated to Python 3.13.2 where possible.
|
||||
Updated to Python 3.13.2.
|
||||
|
||||
7.03.03
|
||||
|
||||
|
||||
1166
src/gam/__init__.py
1166
src/gam/__init__.py
File diff suppressed because it is too large
Load Diff
@@ -89,7 +89,6 @@ SERVICEMANAGEMENT = 'servicemanagement'
|
||||
SERVICEUSAGE = 'serviceusage'
|
||||
SHEETS = 'sheets'
|
||||
SHEETSTD = 'sheetstd'
|
||||
SITES = 'sites'
|
||||
SITEVERIFICATION = 'siteVerification'
|
||||
STORAGE = 'storage'
|
||||
STORAGEREAD = 'storageread'
|
||||
@@ -266,7 +265,6 @@ _INFO = {
|
||||
SERVICEUSAGE: {'name': 'Service Usage API', 'version': 'v1', 'v2discovery': True},
|
||||
SHEETS: {'name': 'Sheets API', 'version': 'v4', 'v2discovery': True},
|
||||
SHEETSTD: {'name': 'Sheets API - todrive', 'version': 'v4', 'v2discovery': True, 'mappedAPI': SHEETS},
|
||||
SITES: {'name': 'Sites API', 'version': 'v1', 'v2discovery': False},
|
||||
SITEVERIFICATION: {'name': 'Site Verification API', 'version': 'v1', 'v2discovery': True},
|
||||
STORAGE: {'name': 'Cloud Storage API', 'version': 'v1', 'v2discovery': True},
|
||||
STORAGEREAD: {'name': 'Cloud Storage API - Read', 'version': 'v1', 'v2discovery': True, 'mappedAPI': STORAGE},
|
||||
@@ -500,11 +498,6 @@ _CLIENT_SCOPES = [
|
||||
'subscopes': [],
|
||||
'offByDefault': True,
|
||||
'scope': 'https://www.googleapis.com/auth/siteverification'},
|
||||
{'name': 'Sites API',
|
||||
'api': SITES,
|
||||
'subscopes': [],
|
||||
'offByDefault': True,
|
||||
'scope': 'https://sites.google.com/feeds'},
|
||||
{'name': 'Vault API',
|
||||
'api': VAULT,
|
||||
'subscopes': READONLY,
|
||||
@@ -694,10 +687,6 @@ _SVCACCT_SCOPES = [
|
||||
'api': SHEETS,
|
||||
'subscopes': READONLY,
|
||||
'scope': 'https://www.googleapis.com/auth/spreadsheets'},
|
||||
{'name': 'Sites API',
|
||||
'api': SITES,
|
||||
'subscopes': [],
|
||||
'scope': 'https://sites.google.com/feeds'},
|
||||
{'name': 'Tasks API',
|
||||
'api': TASKS,
|
||||
'subscopes': READONLY,
|
||||
|
||||
@@ -924,6 +924,7 @@ class GamCLArgs():
|
||||
OB_EXPORT_ITEM = 'ExportItem'
|
||||
OB_FIELD_NAME = 'FieldName'
|
||||
OB_FIELD_NAME_LIST = "FieldNameList"
|
||||
OB_FIELDS = 'Fields'
|
||||
OB_FILE_NAME = 'FileName'
|
||||
OB_FILE_NAME_FIELD_NAME = OB_FILE_NAME+'(:'+OB_FIELD_NAME+')+'
|
||||
OB_FILE_NAME_OR_URL = 'FileName|URL'
|
||||
@@ -1149,6 +1150,10 @@ class GamCLArgs():
|
||||
return f'Command: {self.QuotedArgumentList(self.argv[:self.argvI])} >>>{self.QuotedArgumentList([self.argv[self.argvI]])}<<< {self.QuotedArgumentList(self.argv[self.argvI+1:])}\n'
|
||||
return f'Command: {self.QuotedArgumentList(self.argv)} >>><<<\n'
|
||||
|
||||
# Deprecated command
|
||||
def CommandDeprecated(self):
|
||||
return f'{self.QuotedArgumentList(self.argv)}\n'
|
||||
|
||||
# Peek to see if next argument is in choices
|
||||
def PeekArgumentPresent(self, choices):
|
||||
if self.ArgumentsRemaining():
|
||||
|
||||
@@ -342,8 +342,6 @@ class GamEntity():
|
||||
SHEET = 'shet'
|
||||
SHEET_ID = 'shti'
|
||||
SIGNATURE = 'sign'
|
||||
SITE = 'site'
|
||||
SITE_ACL = 'sacl'
|
||||
SIZE = 'size'
|
||||
SKU = 'sku '
|
||||
SMIME_ID = 'smid'
|
||||
@@ -695,8 +693,6 @@ class GamEntity():
|
||||
SHEET: ['Sheets', 'Sheet'],
|
||||
SHEET_ID: ['Sheet IDs', 'Sheet ID'],
|
||||
SIGNATURE: ['Signatures', 'Signature'],
|
||||
SITE: ['Sites', 'Site'],
|
||||
SITE_ACL: ['Site ACLs', 'Site ACL'],
|
||||
SIZE: ['Sizes', 'Size'],
|
||||
SKU: ['SKUs', 'SKU'],
|
||||
SMIME_ID: ['S/MIME Certificate IDs', 'S/MIME Certificate ID'],
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
# The following GM_XXX constants are arbitrary but must be unique
|
||||
# Most errors print a message and bail out with a return code
|
||||
# Some commands want to set a non-zero return code but not bail
|
||||
# GAM admin user
|
||||
ADMIN = 'admin'
|
||||
# GAM admin user from oauth2.txt or oauth2service.json
|
||||
ADMIN = 'admn'
|
||||
# Drive service for admin; used to look up Shared Drive Names
|
||||
ADMIN_DRIVE = 'addr'
|
||||
# Number/length of API call retries
|
||||
API_CALLS_RETRY_DATA = 'rtry'
|
||||
# GAM cache directory. If no_cache is True, this variable will be set to None
|
||||
@@ -215,6 +217,7 @@ REDIRECT_QUEUE_EOF = 'eof'
|
||||
#
|
||||
Globals = {
|
||||
ADMIN: None,
|
||||
ADMIN_DRIVE: None,
|
||||
API_CALLS_RETRY_DATA: {},
|
||||
CACHE_DIR: None,
|
||||
CACHE_DISCOVERY_ONLY: True,
|
||||
|
||||
@@ -481,6 +481,7 @@ SERVICE_NOT_APPLICABLE = 'Service not applicable/Does not exist'
|
||||
SERVICE_NOT_APPLICABLE_THIS_ADDRESS = 'Service not applicable for this address: {0}'
|
||||
SERVICE_NOT_ENABLED = '{0} Service/App not enabled'
|
||||
SHORTCUT_TARGET_CAPABILITY_IS_FALSE = '{0} capability {1} is False'
|
||||
SITES_COMMAND_DEPRECATED = 'The Classic Sites API is deprecated, this command will not work:\n{0}'
|
||||
SKU_HAS_NO_MATCHING_ARCHIVED_USER_SKU = 'SKU {0} has no matching Archived User SKU'
|
||||
STARTING_THREAD = 'Starting thread'
|
||||
STATISTICS_COPY_FILE = 'Total: {0}, Copied: {1}, Shortcut created {2}, Shortcut exists {3}, Duplicate: {4}, Copy Failed: {5}, Not copyable: {6}, In skipids: {7}, Permissions Failed: {8}, Protected Ranges Failed: {9}'
|
||||
|
||||
@@ -1,283 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2009 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Data model classes for parsing and generating XML for the Sites Data API."""
|
||||
|
||||
import atom
|
||||
import gdata
|
||||
|
||||
# XML Namespaces used in Google Sites entities.
|
||||
SITES_NAMESPACE = 'http://schemas.google.com/sites/2008'
|
||||
SITES_TEMPLATE = '{http://schemas.google.com/sites/2008}%s'
|
||||
SPREADSHEETS_NAMESPACE = 'http://schemas.google.com/spreadsheets/2006'
|
||||
SPREADSHEETS_TEMPLATE = '{http://schemas.google.com/spreadsheets/2006}%s'
|
||||
GACL_NAMESPACE = 'http://schemas.google.com/acl/2007'
|
||||
GACL_TEMPLATE = '{http://schemas.google.com/acl/2007}%s'
|
||||
DC_TERMS_TEMPLATE = '{http://purl.org/dc/terms}%s'
|
||||
THR_TERMS_TEMPLATE = '{http://purl.org/syndication/thread/1.0}%s'
|
||||
XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'
|
||||
XHTML_TEMPLATE = '{http://www.w3.org/1999/xhtml}%s'
|
||||
|
||||
SITES_INVITE_LINK_REL = SITES_NAMESPACE + '#invite'
|
||||
SITES_PARENT_LINK_REL = SITES_NAMESPACE + '#parent'
|
||||
SITES_REVISION_LINK_REL = SITES_NAMESPACE + '#revision'
|
||||
SITES_SOURCE_LINK_REL = SITES_NAMESPACE + '#source'
|
||||
SITES_TEMPLATE_LINK_REL = SITES_NAMESPACE + '#template'
|
||||
|
||||
ALTERNATE_REL = 'alternate'
|
||||
WEB_ADDRESS_MAPPING_REL = 'webAddressMapping'
|
||||
|
||||
SITES_KIND_SCHEME = 'http://schemas.google.com/g/2005#kind'
|
||||
ANNOUNCEMENT_KIND_TERM = SITES_NAMESPACE + '#announcement'
|
||||
ANNOUNCEMENT_PAGE_KIND_TERM = SITES_NAMESPACE + '#announcementspage'
|
||||
ATTACHMENT_KIND_TERM = SITES_NAMESPACE + '#attachment'
|
||||
COMMENT_KIND_TERM = SITES_NAMESPACE + '#comment'
|
||||
FILECABINET_KIND_TERM = SITES_NAMESPACE + '#filecabinet'
|
||||
LISTITEM_KIND_TERM = SITES_NAMESPACE + '#listitem'
|
||||
LISTPAGE_KIND_TERM = SITES_NAMESPACE + '#listpage'
|
||||
WEBPAGE_KIND_TERM = SITES_NAMESPACE + '#webpage'
|
||||
WEBATTACHMENT_KIND_TERM = SITES_NAMESPACE + '#webattachment'
|
||||
FOLDER_KIND_TERM = SITES_NAMESPACE + '#folder'
|
||||
TAG_KIND_TERM = SITES_NAMESPACE + '#tag'
|
||||
|
||||
SUPPORT_KINDS = [
|
||||
'announcement', 'announcementspage', 'attachment', 'comment', 'filecabinet',
|
||||
'listitem', 'listpage', 'webpage', 'webattachment', 'tag'
|
||||
]
|
||||
|
||||
|
||||
class GDataBase(atom.AtomBase):
|
||||
"""The Google Sites intermediate class from atom.AtomBase."""
|
||||
_namespace = gdata.GDATA_NAMESPACE
|
||||
_children = atom.AtomBase._children.copy()
|
||||
_attributes = atom.AtomBase._attributes.copy()
|
||||
|
||||
def __init__(self, text=None):
|
||||
atom.AtomBase.__init__(self, text=text)
|
||||
|
||||
class SitesBase(GDataBase):
|
||||
_namespace = SITES_NAMESPACE
|
||||
|
||||
class SiteName(SitesBase):
|
||||
"""Google Sites <sites:siteName>."""
|
||||
_tag = 'siteName'
|
||||
|
||||
class Theme(SitesBase):
|
||||
"""Google Sites <sites:theme>."""
|
||||
_tag = 'theme'
|
||||
|
||||
class SiteEntry(gdata.BatchEntry):
|
||||
"""Google Sites Site Feed Entry."""
|
||||
_tag = 'entry'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchEntry._children.copy()
|
||||
|
||||
_children['{%s}siteName' % SITES_NAMESPACE] = ('siteName', SiteName)
|
||||
_children['{%s}theme' % SITES_NAMESPACE] = ('theme', Theme)
|
||||
_attributes = gdata.BatchEntry._attributes.copy()
|
||||
_attributes['{%s}etag' % gdata.GDATA_NAMESPACE] = 'etag'
|
||||
|
||||
def __init__(self, siteName=None, title=None, summary=None, theme=None, sourceSite=None, category=None, etag=None):
|
||||
gdata.BatchEntry.__init__(self, category=category)
|
||||
self.siteName = siteName
|
||||
self.title = title
|
||||
self.summary = summary
|
||||
self.theme = theme
|
||||
if sourceSite is not None:
|
||||
sourceLink = atom.Link(href=sourceSite, rel=SITES_SOURCE_LINK_REL, link_type='application/atom+xml')
|
||||
self.link.append(sourceLink)
|
||||
self.etag = etag
|
||||
|
||||
def find_alternate_link(self):
|
||||
for link in self.link:
|
||||
if link.rel == ALTERNATE_REL and link.href:
|
||||
return link.href
|
||||
return None
|
||||
|
||||
FindAlternateLink = find_alternate_link
|
||||
|
||||
def find_source_link(self):
|
||||
for link in self.link:
|
||||
if link.rel == SITES_SOURCE_LINK_REL and link.href:
|
||||
return link.href
|
||||
return None
|
||||
|
||||
FindSourceLink = find_source_link
|
||||
|
||||
def find_webaddress_mappings(self):
|
||||
mappingLinks = []
|
||||
for link in self.link:
|
||||
if link.rel == WEB_ADDRESS_MAPPING_REL and link.href:
|
||||
mappingLinks.append(link.href)
|
||||
return mappingLinks
|
||||
|
||||
FindWebAddressMappings = find_webaddress_mappings
|
||||
|
||||
def SiteEntryFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(SiteEntry, xml_string)
|
||||
|
||||
class SiteFeed(gdata.BatchFeed, gdata.LinkFinder):
|
||||
"""A Google Sites feed flavor of an Atom Feed."""
|
||||
_tag = 'feed'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchFeed._children.copy()
|
||||
_children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry', [SiteEntry])
|
||||
|
||||
def __init__(self):
|
||||
gdata.BatchFeed.__init__(self)
|
||||
|
||||
def SiteFeedFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(SiteFeed, xml_string)
|
||||
|
||||
class AclBase(GDataBase):
|
||||
_namespace = GACL_NAMESPACE
|
||||
|
||||
class AclRole(AclBase):
|
||||
"""Describes the role of an entry in an access control list."""
|
||||
_tag = 'role'
|
||||
_children = AclBase._children.copy()
|
||||
_attributes = AclBase._attributes.copy()
|
||||
_attributes['value'] = 'value'
|
||||
|
||||
def __init__(self, value=None):
|
||||
AclBase.__init__(self)
|
||||
self.value = value
|
||||
|
||||
class AclAdditionalRole(AclBase):
|
||||
"""Describes an additionalRole element."""
|
||||
_tag = 'additionalRole'
|
||||
_children = AclBase._children.copy()
|
||||
_attributes = AclBase._attributes.copy()
|
||||
_attributes['value'] = 'value'
|
||||
|
||||
def __init__(self, value=None):
|
||||
AclBase.__init__(self)
|
||||
self.value = value
|
||||
|
||||
class AclScope(AclBase):
|
||||
"""Describes the scope of an entry in an access control list."""
|
||||
_tag = 'scope'
|
||||
_children = AclBase._children.copy()
|
||||
_attributes = AclBase._attributes.copy()
|
||||
_attributes['type'] = 'type'
|
||||
_attributes['value'] = 'value'
|
||||
|
||||
def __init__(self, stype=None, value=None):
|
||||
AclBase.__init__(self)
|
||||
self.type = stype
|
||||
self.value = value
|
||||
|
||||
|
||||
class AclWithKey(AclBase):
|
||||
"""Describes a key that can be used to access a document."""
|
||||
_tag = 'withKey'
|
||||
_children = AclBase._children.copy()
|
||||
_children['{%s}role' % GACL_NAMESPACE] = ('role', AclRole)
|
||||
_children['{%s}additionalRole' % GACL_NAMESPACE] = ('additionalRole', AclAdditionalRole)
|
||||
_attributes = AclBase._attributes.copy()
|
||||
_attributes['key'] = 'key'
|
||||
|
||||
def __init__(self, key=None, role=None, additionalRole=None):
|
||||
AclBase.__init__(self)
|
||||
self.key = key
|
||||
self.role = role
|
||||
self.additionalRole = additionalRole
|
||||
|
||||
class AclEntry(gdata.BatchEntry):
|
||||
"""Describes an entry in a feed of an access control list (ACL)."""
|
||||
_tag = 'entry'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchEntry._children.copy()
|
||||
|
||||
_children['{%s}role' % GACL_NAMESPACE] = ('role', AclRole)
|
||||
_children['{%s}additionalRole' % GACL_NAMESPACE] = ('additionalRole', AclAdditionalRole)
|
||||
_children['{%s}scope' % GACL_NAMESPACE] = ('scope', AclScope)
|
||||
_children['{%s}withKey' % GACL_NAMESPACE] = ('withKey', AclWithKey)
|
||||
_attributes = gdata.BatchEntry._attributes.copy()
|
||||
_attributes['{%s}etag' % gdata.GDATA_NAMESPACE] = 'etag'
|
||||
|
||||
def __init__(self, role=None, additionalRole=None, scope=None, withKey=None, etag=None):
|
||||
gdata.BatchEntry.__init__(self)
|
||||
self.role = role
|
||||
self.additionalRole = additionalRole
|
||||
self.scope = scope
|
||||
self.withKey = withKey
|
||||
self.etag = etag
|
||||
|
||||
def find_invite_link(self):
|
||||
for link in self.link:
|
||||
if link.rel == SITES_INVITE_LINK_REL and link.href:
|
||||
return link.href
|
||||
return None
|
||||
|
||||
FindInviteLink = find_invite_link
|
||||
|
||||
def AclEntryFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(AclEntry, xml_string)
|
||||
|
||||
class AclFeed(gdata.BatchFeed, gdata.LinkFinder):
|
||||
"""Describes a feed of an access control list (ACL)."""
|
||||
_tag = 'feed'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchFeed._children.copy()
|
||||
_children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry', [AclEntry])
|
||||
|
||||
def __init__(self):
|
||||
gdata.BatchFeed.__init__(self)
|
||||
|
||||
def AclFeedFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(AclFeed, xml_string)
|
||||
|
||||
class ActivityEntry(gdata.BatchEntry):
|
||||
"""Describes an entry in a feed of site activity (changes)."""
|
||||
_tag = 'entry'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchEntry._children.copy()
|
||||
_attributes = gdata.BatchEntry._attributes.copy()
|
||||
|
||||
def __init__(self):
|
||||
gdata.BatchEntry.__init__(self)
|
||||
|
||||
def __find_category_scheme(self, scheme):
|
||||
for category in self.category:
|
||||
if category.scheme == scheme:
|
||||
return category
|
||||
return None
|
||||
|
||||
def kind(self):
|
||||
kind = self.__find_category_scheme(SITES_KIND_SCHEME)
|
||||
if kind is not None:
|
||||
return kind.term[len(SITES_NAMESPACE) + 1:]
|
||||
else:
|
||||
return None
|
||||
|
||||
Kind = kind
|
||||
|
||||
def ActivityEntryFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(ActivityEntry, xml_string)
|
||||
|
||||
class ActivityFeed(gdata.BatchFeed, gdata.LinkFinder):
|
||||
"""Describes a feed of site activity (changes)."""
|
||||
_tag = 'feed'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchFeed._children.copy()
|
||||
_children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry', [ActivityEntry])
|
||||
|
||||
def __init__(self):
|
||||
gdata.BatchFeed.__init__(self)
|
||||
|
||||
def ActivityFeedFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(ActivityFeed, xml_string)
|
||||
@@ -1,246 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright 2009 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""SitesService extends the GDataService for Google Sites API calls."""
|
||||
|
||||
import gdata.apps
|
||||
import gdata.apps.service
|
||||
import gdata.service
|
||||
|
||||
|
||||
# Feed URI templates
|
||||
CONTENT_FEED_TEMPLATE = '/feeds/content/%s/%s/'
|
||||
REVISION_FEED_TEMPLATE = '/feeds/revision/%s/%s/'
|
||||
ACTIVITY_FEED_TEMPLATE = '/feeds/activity/%s/%s/'
|
||||
ACTIVITY_ENTRY_TEMPLATE = '/feeds/activity/%s/%s/%s'
|
||||
SITE_FEED_TEMPLATE = '/feeds/site/%s/'
|
||||
ACL_FEED_TEMPLATE = '/feeds/acl/site/%s/%s'
|
||||
ACL_ENTRY_TEMPLATE = '/feeds/acl/site/%s/%s/%s'
|
||||
|
||||
|
||||
class SitesService(gdata.service.GDataService):
|
||||
"""Client extension for the Google Sites API service."""
|
||||
|
||||
def __init__(self,
|
||||
source=None, server='sites.google.com', additional_headers=None,
|
||||
**kwargs):
|
||||
"""Constructs a new client for the Sites API.
|
||||
|
||||
Args:
|
||||
site: string (optional) Name (webspace) of the Google Site
|
||||
domain: string (optional) Domain of the (Google Apps hosted) Site.
|
||||
If no domain is given, the Site is assumed to be a consumer Google
|
||||
Site, in which case the value 'site' is used.
|
||||
source: string (optional) The name of the user's application.
|
||||
server: string (optional) The name of the server to which a connection
|
||||
will be opened. Default value: 'sites..google.com'.
|
||||
**kwargs: The other parameters to pass to gdata.service.GDataService
|
||||
constructor.
|
||||
"""
|
||||
if additional_headers == None:
|
||||
additional_headers = {}
|
||||
additional_headers['GData-Version'] = '1.4'
|
||||
gdata.service.GDataService.__init__(self,
|
||||
source=source, server=server, additional_headers=additional_headers,
|
||||
**kwargs)
|
||||
self.ssl = True
|
||||
self.port = 443
|
||||
|
||||
def make_site_feed_uri(self, domain=None, site=None):
|
||||
if not domain:
|
||||
domain = 'site'
|
||||
if not site:
|
||||
return SITE_FEED_TEMPLATE % domain
|
||||
return (SITE_FEED_TEMPLATE % domain) + site
|
||||
|
||||
MakeSiteFeedUri = make_site_feed_uri
|
||||
|
||||
def get_site_feed(self, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_site_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.SiteFeedFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetSiteFeed = get_site_feed
|
||||
|
||||
def create_site(self, siteentry=None, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
if uri is None:
|
||||
uri = self.make_site_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Post(siteentry, uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.SiteEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
CreateSite = create_site
|
||||
|
||||
def get_site(self, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_site_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.SiteEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetSite = get_site
|
||||
|
||||
def update_site(self, siteentry=None, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_site_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Put(siteentry, uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.SiteEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
UpdateSite = update_site
|
||||
|
||||
def make_acl_feed_uri(self, domain=None, site=None):
|
||||
return ACL_FEED_TEMPLATE % (domain, site)
|
||||
|
||||
MakeAclFeedUri = make_acl_feed_uri
|
||||
|
||||
def get_acl_feed(self, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.AclFeedFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetAclFeed = get_acl_feed
|
||||
|
||||
def make_acl_entry_uri(self, domain=None, site=None, ruleId=None):
|
||||
return ACL_ENTRY_TEMPLATE % (domain, site, ruleId)
|
||||
|
||||
MakeAclEntryUri = make_acl_entry_uri
|
||||
|
||||
def create_acl_entry(self, aclentry=None, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Post(aclentry, uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.AclEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
CreateAclEntry = create_acl_entry
|
||||
|
||||
def get_acl_entry(self, uri=None, domain=None, site=None, ruleId=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_entry_uri(domain=domain, site=site, ruleId=ruleId)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.AclEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetAclEntry = get_acl_entry
|
||||
|
||||
def update_acl_entry(self, aclentry=None, uri=None, domain=None, site=None, ruleId=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_entry_uri(domain=domain, site=site, ruleId=ruleId)
|
||||
try:
|
||||
return self.Put(aclentry, uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.AclEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
UpdateAclEntry = update_acl_entry
|
||||
|
||||
def delete_acl_entry(self, uri=None, domain=None, site=None, ruleId=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_entry_uri(domain=domain, site=site, ruleId=ruleId)
|
||||
try:
|
||||
return self.Delete(uri,
|
||||
url_params=url_params, escape_params=escape_params, extra_headers=extra_headers)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
DeleteAclEntry = delete_acl_entry
|
||||
|
||||
def make_activity_feed_uri(self, domain=None, site=None):
|
||||
return ACTIVITY_FEED_TEMPLATE % (domain, site)
|
||||
|
||||
MakeActivityFeedUri = make_activity_feed_uri
|
||||
|
||||
def get_activity_feed(self, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_activity_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.ActivityFeedFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetActivityFeed = get_activity_feed
|
||||
|
||||
def make_activity_entry_uri(self, domain=None, site=None, activityId=None):
|
||||
return ACTIVITY_ENTRY_TEMPLATE % (domain, site, activityId)
|
||||
|
||||
MakeActivityEntryUri = make_activity_entry_uri
|
||||
|
||||
def get_activity_entry(self, uri=None, domain=None, site=None, activityId=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_activity_entry_uri(domain=domain, site=site, activityId=activityId)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.ActivityEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetActivityEntry = get_activity_entry
|
||||
|
||||
class SitesQuery(gdata.service.Query):
|
||||
|
||||
def make_site_feed_uri(self, domain=None, site=None):
|
||||
if not domain:
|
||||
domain = 'site'
|
||||
if not site:
|
||||
return SITE_FEED_TEMPLATE % domain
|
||||
return (SITE_FEED_TEMPLATE % domain) + site
|
||||
|
||||
def __init__(self, feed=None, domain=None, site=None, params=None):
|
||||
self.feed = feed or self.make_site_feed_uri(domain=domain, site=site)
|
||||
gdata.service.Query.__init__(self, feed=self.feed, params=params)
|
||||
|
||||
@@ -11,4 +11,4 @@ lxml
|
||||
passlib>=1.7.2
|
||||
pathvalidate
|
||||
python-dateutil
|
||||
yubikey-manager>=5.0
|
||||
yubikey-manager[yubikey]>=5.0
|
||||
|
||||
Reference in New Issue
Block a user