1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Merge pull request #576 from mikkeljuhl/mjuhl/feature/addPermissionReadingToGCal

Google Calendar Read Level
This commit is contained in:
Chris Cummer 2019-09-01 08:12:20 -07:00 committed by GitHub
commit f1c2a4248f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -203,7 +203,7 @@ func (widget *Widget) getCalendarIdList(srv *calendar.Service) ([]string, error)
var calendarIds []string var calendarIds []string
var pageToken string var pageToken string
for { for {
calendarList, err := srv.CalendarList.List().ShowHidden(false).MinAccessRole("writer").PageToken(pageToken).Do() calendarList, err := srv.CalendarList.List().ShowHidden(false).MinAccessRole(widget.settings.calendarReadLevel).PageToken(pageToken).Do()
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -26,10 +26,11 @@ type Settings struct {
email string `help:"The email address associated with your Google account. Necessary for determining 'responseStatus'." values:"A valid email address string."` email string `help:"The email address associated with your Google account. Necessary for determining 'responseStatus'." values:"A valid email address string."`
eventCount int `help:"The number of calendar events to display." values:"A positive integer, 0..n." optional:"true"` eventCount int `help:"The number of calendar events to display." values:"A positive integer, 0..n." optional:"true"`
multiCalendar bool `help:"Whether or not to display your primary calendar or all calendars you have access to." values:"true or false" optional:"true"` multiCalendar bool `help:"Whether or not to display your primary calendar or all calendars you have access to." values:"true or false" optional:"true"`
secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."` secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
showDeclined bool `help:"Whether or not to display events youve declined to attend." values:"true or false" optional:"true"` showDeclined bool `help:"Whether or not to display events youve declined to attend." values:"true or false" optional:"true"`
withLocation bool `help:"Whether or not to show the location of the appointment." values:"true or false"` withLocation bool `help:"Whether or not to show the location of the appointment." values:"true or false"`
timezone string `help:"The time zone used to display calendar event times." values:"A valid TZ database time zone string" optional:"true"` timezone string `help:"The time zone used to display calendar event times." values:"A valid TZ database time zone string" optional:"true"`
calendarReadLevel string `help:"The calender read level specifies level you want to read events. Default: writer " values:"reader, writer", optional: "true"`
} }
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings { func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
@ -47,6 +48,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
showDeclined: ymlConfig.UBool("showDeclined", false), showDeclined: ymlConfig.UBool("showDeclined", false),
withLocation: ymlConfig.UBool("withLocation", true), withLocation: ymlConfig.UBool("withLocation", true),
timezone: ymlConfig.UString("timezone", ""), timezone: ymlConfig.UString("timezone", ""),
calendarReadLevel: ymlConfig.UString("calendarReadLevel", "writer"),
} }
settings.colors.day = ymlConfig.UString("colors.day", "forestgreen") settings.colors.day = ymlConfig.UString("colors.day", "forestgreen")