Skip to content

Commit

Permalink
Merge pull request #42 from mxstack/zope-emergency-user
Browse files Browse the repository at this point in the history
feat: add zope-adduser target
  • Loading branch information
jensens authored Feb 13, 2025
2 parents c9c36d4 + cf25174 commit 5f7ebcc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.1.0 (unreleased)

- Feature: Add target `zope-adduser` to create an emergency user.

## 1.0 (2025-02-11)

- Chore: Add release workflow.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "mxmake"
description = "Generates a Python project-specific Makefile by using an extensible library of configurable Makefile snippets."
version = "1.0"
version = "1.1.0.dev0"
keywords = ["development", "deployment", "make"]
authors = [
{name = "MX Stack Developers", email = "[email protected]" }
Expand Down
19 changes: 19 additions & 0 deletions src/mxmake/topics/applications/zope.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@
#:[setting.ZOPE_SCRIPTNAME]
#:description = script to run
#:
#:[target.zope-adduser]
#:description = Adds an [emergency user](https://zope.readthedocs.io/en/latest/zopebook/Security.html#zope-emergency-user) to Zope.
#: This is an user with the Manager role created in the Zope application roots user folder!
#: This is not meant to do user management, but to get access to a Zope site if all other passwords are gone.
#: The user name must not exist already in the application roots user folder.
#: ZOPE_USER_NAME and ZOPE_USER_PASSWORD should not be set in the Makefile, but passed in as environment variables.
#: Example: `make ZOPE_USER_NAME=emergency ZOPE_USER_PASSWORD=verysecret adduser`
#:
#:[setting.ZOPE_USER_NAME]
#:description = user name to create
#:
#:[setting.ZOPE_USER_PASSWORD]
#:description = user name to create
#:
#:[target.zope-dirty]
#:description = Touches the configuration file to force a rebuild of the Zope instance.
#:
Expand Down Expand Up @@ -85,6 +99,11 @@ zope-runscript: $(ZOPE_RUN_TARGET)
@echo "Run Zope/Plone Console Script $(ZOPE_SCRIPTNAME) in $(ZOPE_INSTANCE_FOLDER)"
@zconsole run "$(ZOPE_INSTANCE_FOLDER)/etc/zope.conf" $(ZOPE_SCRIPTNAME)

.PHONY: zope-adduser
zope-adduser: $(ZOPE_RUN_TARGET)
@echo "Run Zope addzopeuser to create an emergency user '$(ZOPE_USER_NAME)' with role 'Manager'"
@addzopeuser -c "$(ZOPE_INSTANCE_FOLDER)/etc/zope.conf" $(ZOPE_USER_NAME) $(ZOPE_USER_PASSWORD)

.PHONY: zope-dirty
zope-dirty:
@touch ${ZOPE_CONFIGURATION_FILE}
Expand Down

0 comments on commit 5f7ebcc

Please sign in to comment.