dp-permissions-api

command module
v1.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

dp-permissions-api

API for managing access control permissions for Digital Publishing API resources

Getting started

  • Load inital roles into your local mongodb using the import-script utility in the import-script folder. Follow the steps in the README.
  • Run make debug

Tools

To run some of our tests you will need additional tooling:

Audit

We use dis-vulncheck to do auditing, which you will need to install.

For Java auditing we use mvn ossindex:audit which requires you to set up an OSS Index account and make some updates to Maven: Local Setup for ossindex:audit

Linting

We use v2 of golangci-lint, which you will need to install.

Validating Specification

To validate the swagger specification you can do this via:

make validate-specification

To run this, you will need to run Node > v24 and have redocly CLI installed:

npm install -g redocly-cli
Dependencies
  • run mongo DB locally on 27017 with:
    • database name: 'permissions'
    • collections: 'roles, policies'

This can be done via the v1 compat stack in dp-compose.

Configuration
Environment variable Default Description
BIND_ADDR :25400 The host and port to bind to
GRACEFUL_SHUTDOWN_TIMEOUT 5s The graceful shutdown timeout in seconds (time.Duration format)
HEALTHCHECK_INTERVAL 30s Time between self-healthchecks (time.Duration format)
HEALTHCHECK_CRITICAL_TIMEOUT 90s Time to wait until an unhealthy dependent propagates its state to make this app unhealthy (time.Duration format)
MONGODB_BIND_ADDR localhost:27017 The MongoDB bind address
MONGODB_USERNAME The MongoDB Username
MONGODB_PASSWORD The MongoDB Password
MONGODB_DATABASE permissions The MongoDB database
MONGODB_COLLECTIONS RolesCollection:roles, PoliciesCollection:policies The MongoDB collections
MONGODB_REPLICA_SET The name of the MongoDB replica set
MONGODB_ENABLE_READ_CONCERN false Switch to use (or not) majority read concern
MONGODB_ENABLE_WRITE_CONCERN true Switch to use (or not) majority write concern
MONGODB_CONNECT_TIMEOUT 5s The timeout when connecting to MongoDB (time.Duration format)
MONGODB_QUERY_TIMEOUT 15s The timeout for querying MongoDB (time.Duration format)
MONGODB_IS_SSL false Switch to use (or not) TLS when connecting to mongodb
DEFAULT_LIMIT 20 Default limit for pagination
DEFAULT_OFFSET 0 Default offset for pagination
DEFAULT_MAXIMUM_LIMIT 1000 Default maximum limit for pagination

dp-permissions-api also implements the dp-authorisation library config for managing authentication and authorisation.

SDK Package

This API has two SDKs available:

Moving the Go package or having a folder for both SDKs would cause a breaking change for the Go SDK which we do not want to introduce at this time.

Contributing

See CONTRIBUTING for details.

License

Copyright © 2025, Office for National Statistics https://www.ons.gov.uk

Released under MIT license, see LICENSE for details.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
features
sdk

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL