Nextcloud App to hide shared nextcloud calendars on user login
| calhider | ||
| LICENSE | ||
| README.md | ||
Nextcloud CalHider App
A lightweight Nextcloud app that automatically hides all shared calendars for new users on their first login.
This ensures that every user starts with a clean calendar view and can selectively enable only the calendars they actually need.
Features
- Automatically hides all shared calendars on the first login of a new user.
- Uses a guard flag (
initial-hide-done) so the operation only runs once per user. - OCC command to show, set, or unset the guard flag.
- Optional one-time rollout command (
seed-guard) to initialize the guard flag for existing users.
Installation
- Place the app into the Nextcloud
apps/directory, e.g.apps/calhider. - Set the owner to
www-data:chown -R www-data:www-data apps/calhider - Enable the app:
php occ app:enable calhider
OCC Commands
Guard Flag Control
# Show the guard flag status for a user
php occ org:calendar:guard --show <userId>
# Set the guard flag (user will no longer be auto-processed)
php occ org:calendar:guard --set <userId>
# Unset the guard flag (user will be processed again at next login)
php occ org:calendar:guard --unset <userId>
Optional: Rollout for Existing Users
If you want to prevent all existing users from being processed on their next login:
# Dry run (shows which users would be marked)
php occ org:calendar:seed-guard --dry-run
# Mark all existing users as "done"
php occ org:calendar:seed-guard
After running this once, you can remove the
SeedGuardcommand fromappinfo/info.xmland delete the fileSeedGuard.php.
How It Works
- A new user is created via OIDC/LDAP/provisioning.
- At the first login, the event listener (
UserLoggedInListener) triggers. - If the guard flag is not set:
CalDavHiderhides all shared calendars for that user.- The guard flag is then set.
- Subsequent logins are unaffected.
Debugging
- Debug logs are written to
data/calhider-debug.log. - You can check a user’s guard status with:
php occ org:calendar:guard --show <uid>
License
AGPLv3 (as required for Nextcloud apps)