mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-24 08:01:36 +00:00
Updated countsonly option of gam <UserTypeEntity> print|show notes to additionally display the total number of notes.
This commit is contained in:
@@ -2,10 +2,14 @@
|
||||
|
||||
Merged GAM-Team version
|
||||
|
||||
6.72.09
|
||||
|
||||
Updated `countsonly` option of `gam <UserTypeEntity> print|show notes` to additionally display the total number of notes.
|
||||
|
||||
6.72.08
|
||||
|
||||
Added option `countsonly` to `gam <UserTypeEntity> print|show notes` that displays
|
||||
the number of notes a user owns and the number of notes of user can edit.
|
||||
the number of notes a user owns and the number of notes a user can edit.
|
||||
|
||||
6.72.07
|
||||
|
||||
|
||||
@@ -71349,7 +71349,7 @@ def printShowNotes(users):
|
||||
csvPF.RemoveJSONTitles(['owner', 'ownedByMe'])
|
||||
if countsOnly and csvPF:
|
||||
if not FJQC.formatJSON:
|
||||
csvPF.SetTitles(['User', 'noteOwner', 'noteWriter'])
|
||||
csvPF.SetTitles(['User', 'noteOwner', 'noteWriter', 'totalNotes'])
|
||||
else:
|
||||
csvPF.SetJSONTitles(['User', 'JSON'])
|
||||
fields = getItemFieldsFromFieldsList('notes', fieldsList, returnItemIfNoneList=False)
|
||||
@@ -71370,27 +71370,30 @@ def printShowNotes(users):
|
||||
throwReasons=GAPI.KEEP_THROW_REASONS,
|
||||
filter=noteFilter, fields=fields)
|
||||
if countsOnly:
|
||||
noteCounts = {'User': user, 'noteOwner': 0, 'noteWriter': 0}
|
||||
noteCounts = {'User': user, 'noteOwner': 0, 'noteWriter': 0, 'totalNotes': 0}
|
||||
for note in notes:
|
||||
noteCounts['totalNotes'] += 1
|
||||
for permission in note['permissions']:
|
||||
if permission.get('user', {}).get('email', '').lower() == user:
|
||||
noteCounts[NOTES_COUNTS_MAP[permission['role']]] += 1
|
||||
break
|
||||
if not csvPF:
|
||||
if not FJQC.formatJSON:
|
||||
printEntityKVList([Ent.USER, user], ['noteOwner', noteCounts['noteOwner'], 'noteWriter', noteCounts['noteWriter']], i, count)
|
||||
printEntityKVList([Ent.USER, user], ['noteOwner', noteCounts['noteOwner'],
|
||||
'noteWriter', noteCounts['noteWriter'],
|
||||
'totalNotes', noteCounts['totalNotes']], i, count)
|
||||
else:
|
||||
printLine(json.dumps(cleanJSON(noteCounts), ensure_ascii=False, sort_keys=True))
|
||||
else:
|
||||
row = {'User': user, 'noteOwner': noteCounts['noteOwner'], 'noteWriter': noteCounts['noteWriter']}
|
||||
row = {'User': user, 'noteOwner': noteCounts['noteOwner'], 'noteWriter': noteCounts['noteWriter'],
|
||||
'totalNotes': noteCounts['totalNotes']}
|
||||
if not FJQC.formatJSON:
|
||||
csvPF.WriteRowTitles(row)
|
||||
elif csvPF.CheckRowTitles(row):
|
||||
row = {'User': noteCounts.pop('User')}
|
||||
row['JSON'] = json.dumps(cleanJSON(noteCounts), ensure_ascii=False, sort_keys=True)
|
||||
csvPF.WriteRowNoFilter(row)
|
||||
continue
|
||||
if not csvPF:
|
||||
elif not csvPF:
|
||||
jcount = len(notes)
|
||||
if not FJQC.formatJSON:
|
||||
entityPerformActionNumItems([Ent.USER, user], jcount, Ent.NOTE, i, count)
|
||||
|
||||
Reference in New Issue
Block a user