Synchronizes Southern California Mountaineers Association (SCMA) calendar events to Google Calendar.

Overview

SCMA Google Calendar Sync

CI Sync

Synchronizes Southern California Mountaineers Association (SCMA) calendar events to Google Calendar.

asciicast

Credentials

SCMA website username

Specified via the SCMA_USERNAME environment variable or the -u|--username option.

SCMA website password

Specified via the SCMA_PASSWORD environment variable or the -p|--password option.

Google Calendar client secret

Obtain OAuth client ID credentials via the Google Developer Console. Stored as a JSON file. Path to JSON file specified via the GCAL_CLIENT_SECRET_PATH environment variable or the --client-secret-json-path option. Default path is client_secret.json.

  1. Create a project

  2. Add Google Calendar API

  3. Create OAuth Client ID credentials

  4. Download OAuth Client ID JSON

  5. Configure OAuth consent screen

    1. Add https://wwww.googleapis.com/auth/calendar scope

    2. Add email to test users

Google Calendar OAuth token

Obtain on first run of scma-gcal-sync with gcal output. Follow on screen instructions. Stored as a JSON file. Path to JSON file specified via the GCAL_OAUTH_TOKEN_JSON_PATH environment variable or the --oauth-token-json-path option. Default path is token.json.

Examples

Web to YAML

Fetches events from the SCMA website and converts them to YAML.

scma-gcal-sync -u <scma-username> -p <scma-password> -o yaml > events.yml

YAML to GCal

scma-gcal-sync -i yaml --ifile events.yml

Web to GCAL

scma-gcal-sync -u <scma-username> -p <scma-password>

Limitations

Only all-day events are supported. SCMA events that are not all-day events are converted to all-day events. Effectively, the time information is stripped.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Comments
  • Calendar contains events with bad dates

    Calendar contains events with bad dates

    From Suzanne on Mon, Sep 19, 7:44 AM (2 days ago):

    Hi Rob,

    Hoping you can help me out with something. There are two RCSC classes in March that had screwed up dates. We changed the dates, but it was still incorrect on the Google Calendar, so we ended up deleting them and recreating new ones. The two deleted events are still on the google calendar though after two days. Can you please help removed, or help me understand how I can remove?

    Thank you very much, -Suzanne

    opened by rfdonnelly 4
  • ACL add and delete for same set of emails on every run

    ACL add and delete for same set of emails on every run

    On every run, I get the following message (emails have been anonymized) for the same two users.

    2022-02-02T03:41:28.586925Z  INFO scma_gcal_sync::output::gcal: Determined sync operations ops.len=4 ops=[Insert("[email protected]"), Insert("[email protected]"), Delete("[email protected]"), Delete("[email protected]")]
    

    I suspect that Google Calendar is resolving email aliases behind the scenes. For example, if I insert [email protected] Google Calendar returns a response that it inserted [email protected]. But when I do an acl.list, I don't get back [email protected] . Instead, I get back [email protected]. In between the acl.insert response and and the acl.list, Google Calendar resolved the email alias and replaced the ACL rule with the resolved email address.

    Until this is resolved, the calendar will be removed from these users' Google Calendar on every run and therefore unusable.

    The first solution that comes to mind is an email map that maps an SCMA member's email address to the resolved email address. The email map would be represented as a list of key-value pairs. Or JSON. Something like:

    {
      "[email protected]": "[email protected]",
      "[email protected]": "[email protected]"
    }
    
    bug 
    opened by rfdonnelly 3
  • Event sync workflow failing due to OAuth token expiration

    Event sync workflow failing due to OAuth token expiration

    The app currently uses an OAuth 2.0 Client ID (OACID) to authenticate with Google Calendar. It turns out that this flow generates OAuth tokens with a short lifetime (measured in days) when the Google Cloud Platform (GCP) project publishing status is "testing". To get tokens that unlimited lifetime tokens, the GCP project must be published. To get published, it needs to go through verification. To get verified, the app needs a privacy policy (see PRIVACY.adoc). Then you need to wait 4-6 weeks. I've initiated the process and am now waiting for the response.

    The other option is to use a Service Account (SA) instead of the of an OACID. This has several benefits over the OACID.

    • SAs don't require user interaction. Unlimited-lifetime OACID tokens require a one time user interaction to login and accept access.
    • SAs don't require a verification process

    There is one slight complication however. SAs do not have access to the user's Google Calendar data. Instead, SAs seem to only have access to GCP project data. In other words, the SA effectively has its own Google Calendar account. See SO. It can create a calendar then give co-ownership of said calendar to the user. But it cannot access a user's calendar directly. This requires the application to implement additional calendar management logic including calendar creation and granting co-ownership.

    bug 
    opened by rfdonnelly 3
  • Road to production

    Road to production

    • [x] Create GitHub Action for production event sync
    • [x] Create GitHub Action for production ACL sync (with ACL insert notifications disabled)
    • [x] Transition all beta testers to production calendar
    • [x] Clear with SCMA board
    • [x] Beta test for one week
    • [x] Announce SCMA Google Calendar on SCMA blog (to notify current members)
    • [x] #37
    opened by rfdonnelly 1
  • Limit fetching to dates of interest

    Limit fetching to dates of interest

    scma-gcal-sync currently fetches all events when fetching the event list but then only uses the present/active and future events by default (see the --all option). This puts unnecessary load on the SCMA server and creates unnecessary traffic on the wire.

    After some searching, I found some source code for Ohanah, the third-party Joomla extension that the SCMA website uses to manage events. I reviewed the source and found some promising query parameters. In particular, I found the starting_date parameter (see views/events/json.php:39).

    I tried this with a YYYY-MM-DD formatted date and it worked!

    Update the event list fetching to include this when the min_date is Some(date).

    enhancement 
    opened by rfdonnelly 1
  • Exclude attendees and comments sections from description

    Exclude attendees and comments sections from description

    when none present. This was the original intent but not how it turned out.

    The alternative is to keep the sections and display "None".

    Example of Issue

    image bug 
    opened by rfdonnelly 1
  • Migrate from scma-gcal-sync-rb to scma-gcal-sync

    Migrate from scma-gcal-sync-rb to scma-gcal-sync

    Migrate from the old Ruby version to this new Rust version.

    • [x] Disable scma-gcal-sync-rb workflow
    • [x] Delete all events from the existing SCMA Google calendar
    • [x] Change default calendar from "SCMA Test" to "SCMA"
    • [x] Run scma-gcal-sync --all to fully populate the calendar
    • [x] Publish a v1.2.0 release
    opened by rfdonnelly 1
  • Update dependencies

    Update dependencies

    This PR upgrades depedencies.

    NOTES:

    • hyper-rusttls had a breaking change that required a small refactor
    • Cannot use yup-oauth2 v7. Need to use the same version as the Google API crates which is v6.

    BREAKING CHANGE:

    This change invalidates any previous OAuth tokens.

    opened by rfdonnelly 0
  • Unexpected ACL deletes

    Unexpected ACL deletes

    Occasionally an active user will be unexpectedly deleted from the Google Calendar ACL.

    After some debugging, it was found that the email obfuscation used on the SCMA roster webpage sometimes reuses "addy" IDs for the same user. The scma-gcal-sync email deobfuscation algorithm assumes the "addy" IDs are unique. The deobfuscation algorithm needs to be updated to handle reuse of "addy" IDs.

    The problem will cause a user to incorrectly have the email address of another user.

    This problem can may also create problems with the Google Contacts syncing.

    bug 
    opened by rfdonnelly 0
  • Add service account authentication

    Add service account authentication

    This PR adds the --auth-type (oauth|service-account|infer) option that defaults to infer. The possible values are:

    • oauth -- Use OAuth user account authentication
    • service-account -- Use service account authentication
    • infer -- Infer the auth-type based on the service.
      • Google Calendar infers service-account
      • Google People infers oauth.

    BREAKING CHANGE: This changes the default authentication type for the Google Calendar API from OAuth to service account authentication.

    Closes #25

    enhancement 
    opened by rfdonnelly 0
  • v1.4.0

    v1.4.0

    This release adds the ability to sync users to both the Google Calendar ACL (Access Control List) and Google Contacts. The ACL sync feature automates calendar access management. It gives all SCMA members read access to the calendar and removes access for any non-SCMA members (i.e. those that are no longer SCMA members).

    Added

    • Added auto create the named calendar if it doesn't exist
    • Added --dry-run option
    • Added Google Calendar ACL sync
    • Added Google Contacts sync

    Changed

    • Normalize SCMA phone numbers using "+1##########" format. Previously used the whatever format was given which varied from member to member.
    • Normalize SCMA emails to use all lowercase. Previously used whatever case was given which varied from member to member.
    enhancement 
    opened by rfdonnelly 0
  • `RUST_LOG` doesn't work

    `RUST_LOG` doesn't work

    Running with RUST_LOG=debug doesn't enable debug output. This is likely due to the use of the add_directive("info".parse()?) call.

    Removing the add_directive("info".parse()?) call, from the default EnvFilter, fixes RUST_LOG=debug. However, when RUST_LOG is undefined, now info output doesn't show.

    A workaround is available at https://github.com/tokio-rs/tracing/issues/735#issuecomment-957884930

    bug 
    opened by rfdonnelly 0
Releases(v2.0.4)
  • v2.0.4(Sep 24, 2022)

  • v2.0.3(Sep 23, 2022)

  • v2.0.2(Jul 8, 2022)

  • v2.0.1(Mar 28, 2022)

  • v2.0.0-rc.3(Feb 3, 2022)

  • v2.0.0-rc.2(Feb 2, 2022)

  • v2.0.0-rc.1(Feb 1, 2022)

    This release makes several breaking changes in preparation for production. The biggest change is the addition of service account authentication.

    Added

    • Added support for service account authentication
    • Added calendar description to calendar creation
    • Added --notify-acl-insert option
    • Added --calendar-owner option
    • Added user guide and admin guide
    • Added workflows for shared calendar sync and personal contacts sync
    • Added sections to --help output

    Changed

    • Changed the default authentication type for Google Calendar from OAuth to service account authentication
    • Changed the --dry-run option to apply to all API methods that create, modify, or delete (including calendar and contact group creation)
    • Changed environment variable names
      • Renamed GCAL_CLIENT_SECRET_PATH to GOOGLE_CLIENT_SECRET_PATH
      • Renamed GCAL_OAUTH_TOKEN_JSON_PATH to GOOGLE_OAUTH_TOKEN_PATH
    • Changed option names
      • Renamed --client-secret-json-path to --secret-file
      • Renamed --oauth-token-json-path to --token-file
    • Changed default for the --client-secret-json-path (now --secret-file) option from client_secret.json to secret.json
    • Changed the --data option to an argument. Instead of scma-gcal-sync -d users, now it is just scma-gcal-sync users.
    Source code(tar.gz)
    Source code(zip)
    scma-gcal-sync(11.90 MB)
  • v1.4.0(Jan 30, 2022)

    This release adds the ability to sync users to both the Google Calendar ACL (Access Control List) and Google Contacts. The ACL sync feature automates calendar access management. It gives all SCMA members read access to the calendar and removes access for any non-SCMA members (i.e. those that are no longer SCMA members).

    Added

    • Added auto create the named calendar if it doesn't exist
    • Added --dry-run option
    • Added Google Calendar ACL sync
    • Added Google Contacts sync

    Changed

    • Normalize SCMA phone numbers using +1########## format. Previously used the whatever format was given which varied from member to member.
    • Normalize SCMA emails to use all lowercase. Previously used whatever case was given which varied from member to member.
    Source code(tar.gz)
    Source code(zip)
    scma-gcal-sync(11.76 MB)
  • v1.3.0(Jan 20, 2022)

    This release adds the ability to download SCMA member information as YAML and fixes multiple OAuth requests due to use of multiple scopes.

    Added

    • Fetching and parsing of users
    • YAML serialization of users
    • Privacy policy

    Fixed

    • Multiple OAuth requests due to use of multiple scopes
    • Log filtering via the RUST_LOG environment variable
    Source code(tar.gz)
    Source code(zip)
    scma-gcal-sync(9.87 MB)
  • v1.2.1(Jan 17, 2022)

  • v1.2.0(Jan 13, 2022)

    This release marks the migration from the old Ruby implementation to this new Rust implementation. The Ruby implementation has been taken out of service and this Rust implementation has taken its place.

    Changes Since v1.1.1

    In addition to the migration, several improvements to the Google Calendar event descriptions have been made. See #4 for the tracking issue.

    Changed

    • Changed default calendar name from "SCMA Test" to "SCMA" (#3)

    Added

    • Added "last synced by" information to description (#11)
    • Added "last synced at" information to description (#10)
    • Added explicit "None" when no attendees/comments (#7)
    • Added order to list of attendees (#6)
    • Added heading for SCMA event description (#8)

    Fixed

    • Fixed description rich text (#5)

    Comparison to the Ruby Implementation

    • Fully async (performs multiple requests concurrently)
    • Can fetch all events. Ruby implementation was limited to future events that fit on first page of events list. This is enabled by the discovery of a JSON formatted event list that contains all events.
    • Uses more efficient patch-or-insert algorithm to update Google Calendar. The Ruby implementation used a delete-readd algorithm.
    • Improved documentation (README and --help)
    Source code(tar.gz)
    Source code(zip)
    scma-gcal-sync(8.84 MB)
  • v1.1.1(Jan 13, 2022)

  • v1.1.0(Jan 13, 2022)

    Previously in v1.0.0, only fetching of event details was concurrent. We'd wait for all fetching to complete before updating Google Calendar. Google Calendar updates were not concurrent. This release maximizes concurrency. Everything that could be made concurrent was.

    • Authentication with the two sites (SCMA and GCal) was made concurrent
    • Updating GCal was made concurrent (multiple GCal events are updated concurrently)
    • SCMA event fetching was made concurrent with GCal event updating
    Source code(tar.gz)
    Source code(zip)
Owner
Rob Donnelly
Rob Donnelly
A fast, searchable, knowledge engine using various machine learning models to aggregate based on importance, association and relevance

NewsAggregator We live in an era where both the demand and quantity of information are enormous. However, the way we store and access that information

EngineersBox 5 Aug 19, 2022
A Telegram bot synchronizes Telegram messages to Mastodon.

tgbot-mastodon-sync A Telegram bot synchronizes Telegram messages to Mastodon. Official hosted account: @mastodon_sync_bot Self-Host 1. Install binary

Sprite 7 Mar 5, 2023
The simplest way to de-Google your life and business: Inbox, Calendar, Files, Contacts & much more

Bloom The all-in-one private workspace Try it for free! You no longer trust tech monopolies with your data? You are done with your privacy invaded by

Sylvain Kerkour 1.6k Dec 26, 2022
The implementation of the Persian (Solar Hijri) Calendar in Rust

Rust Persian Calendar Rust Persian Calendar v0.1.1 provides functionality for conversion among Persian (Solar Hijri) and Gregorian calendars. A Julian

Navid 27 Mar 5, 2022
⚡️ Lightning-fast and minimal calendar command line. Written in Rust 🦀

⚡️ Lightning-fast and minimal calendar command line. It's similar to cal. Written in Rust ??

Arthur Henrique 36 Jan 1, 2023
Scrypto Advent Calendar. Learn the new programming langage to build quick and secure DeFi applications.

Scrypto Advent Calendar I am publishing new Christmas related Scrypto examples every day from Dec 1st to Dec 25th. "Watch" this project to get notifie

Clement Bisaillon 26 Nov 13, 2022
carl is a calendar for the commandline.

carl is a calendar for the commandline. It tries to mimic the various cal(1) implementations out there, but also adds enhanced features like colors and ical support.

Birger Schacht 1 Jan 2, 2022
a day-planner/calendar app based on egui

Malakal Malakal is a day planner application. I crafted it because I was not able to find a comfortable calendar application for Linux. I myself have

null 5 Dec 21, 2022
Linkal - A public-calendar aggregator server

Linkal Linkal is a public-calendar aggregator server. Given a set a public calendars links, it can make a CalDav client believe all these calendars ar

Julien Malka 87 Dec 10, 2022
🚫📆 Serverless calendar built with shuttle.rs

zerocal ?? ?? Welcome to zerocal, the serverless calendar. It allows you to create calendar invites from the convenience of your terminal! ?? Here's m

Matthias 150 Jan 2, 2023
A simple program for handling Ethiopian calendar dates.

Mek’ut’erīya A simple program for handling Ethiopian calendar dates. Installation cargo install --git https://github.com/frectonz/mek-ut-er-ya If you

Fraol Lemecha 15 Dec 20, 2022
Get your loadshedding schedule in your calendar and never be left in the dark! Open-source, up-to-date, and developer friendly.

Loadshedding schedules in your digital calendar. No apps, no ads, up-to-date, and developer friendly. Get it • Key Features • Using the data • Project

Boyd Kane 117 Apr 26, 2023
A library for simulating mouse and keyboard events

The Fat Controller TFC is a library for simulating mouse and keyboard events. This library was built for use by TFC-server, a server that allows for r

Indiana Kernick 37 Nov 28, 2022
A utility for mapping events from Linux event devices.

What is evsieve? Evsieve (from "event sieve") is a low-level utility that can read events from Linux event devices (evdev) and write them to virtual e

Kars Mulder 116 Jan 2, 2023
Converts Hikvision camera events to MQTT

HikSink streams Hikvision camera and NVR events (motion, line crossing, tamper, illegal logins, etc.) to MQTT messages for consumption by home automat

Corner Bit 48 Dec 27, 2022
Emit ETW events in tracing-enabled Rust applications.

tracing-etw Emit ETW events in tracing-enabled Rust applications. This crate depends on rust_win_etw. There are four ETW events. fn NewSpan(span_id: u

Microsoft 11 Aug 10, 2022
global allocator that provides hooks for tracking allocation events

tracking-allocator A GlobalAlloc-compatible allocator implementation that provides the ability to track allocation events. examples As allocators are

Toby Lawrence 39 Dec 22, 2022
Send copy events over the network

Copiepate Copiepate is a small utility to remotely set the content of a clipboard. I created this tool as I frequently use a remote tmux+vim setup and

Loïc Carr 14 Jun 12, 2022
Simple async library for triggering IFTTT events using webhooks.

IFTTT Webhook A simple Rust async library for triggering IFTTT events using webhooks. Installation Installation can be performed using cargo add: carg

Leo Dutra 1 Mar 11, 2021
Scalable and fast data store optimised for time series data such as financial data, events, metrics for real time analysis

OnTimeDB Scalable and fast data store optimised for time series data such as financial data, events, metrics for real time analysis OnTimeDB is a time

Stuart 2 Apr 5, 2022