Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9ebb2206c | ||
|
|
b6ec9feeae
|
||
|
|
a1c9ace5ec | ||
|
|
250d017f93 | ||
|
|
f48319ffb0 | ||
|
|
10c3448ec3 | ||
|
|
3e0bb48af7 | ||
|
|
c9169d5cbc | ||
|
|
e8da7bb3e9 | ||
|
|
1755ed37dd | ||
|
|
d2faf4bd88 | ||
|
|
96001183fb | ||
|
|
f652c92328 | ||
|
|
4152e9830f | ||
|
|
caafda1f7c | ||
|
|
e2041fe618 | ||
|
|
a05c89475f | ||
|
|
a028c38a4d | ||
|
|
982fb0bb09 | ||
|
|
ce344d29bf | ||
|
|
4e29b77504 | ||
|
|
d2492e98fa | ||
|
|
35b8148f7f | ||
|
|
3a9bd8dffe | ||
|
|
c8b6f33464 | ||
|
|
ff672b7a81 | ||
|
|
dba9093ed4 | ||
|
|
e02917ba5d | ||
|
|
05425c1d5f | ||
|
|
b42a60844e | ||
|
|
72b66efc07 | ||
|
|
fb45f1eccc | ||
|
|
b10691a7ad | ||
|
|
0677bb1e60 | ||
|
|
3bc038ba17 | ||
|
|
1c870c3d4e | ||
|
|
8b8bf53790
|
||
|
|
1f20ead820 | ||
|
|
6b567fce3c | ||
|
|
08000f5e9f | ||
|
|
761bd0d75b | ||
|
|
2f7cf19696 | ||
|
|
06a017f5a5 | ||
|
|
0a5e432071 | ||
|
|
957d9229b1 | ||
|
|
681804c5e4 | ||
|
|
50a6071eec
|
||
|
|
c7ceee0a14 | ||
|
|
09f0769a3e | ||
|
|
ae9ac8b449 | ||
|
|
7f251668b2 | ||
|
|
114883aef4 | ||
|
|
6c0dbaf903 | ||
|
|
b0a1757e38
|
||
|
|
d6736b0187 | ||
|
|
668e0dacfb | ||
|
|
1c2e98a973 | ||
|
|
026fe0ab3f | ||
|
|
6b15aac9f3 | ||
|
|
001f23eab5 | ||
|
|
e3c303b162 | ||
|
|
61204541a4 | ||
|
|
fbd579a4f6 | ||
|
|
7a1a0b5941 | ||
|
|
d6db4b664c | ||
|
|
44a711baa1 | ||
|
|
63ae255179 | ||
|
|
24f3184ccc | ||
|
|
b6f20b7ae0
|
||
|
|
c009f3d87c | ||
|
|
e197f2c7da | ||
|
|
2655fcb211 | ||
|
|
9fcbdd259b | ||
|
|
ba73d36b91 | ||
|
|
739440046b | ||
|
|
2243597853 | ||
|
|
e9e684949c | ||
|
|
a6426f5973 | ||
|
|
e29f5b331b | ||
|
|
e1b2e5a5c1 | ||
|
|
7371d54831 | ||
|
|
badfe89281 | ||
|
|
17dd541cc6 | ||
|
|
4ad0fb4f86 | ||
|
|
a53df01028 | ||
|
|
622179a6b1 | ||
|
|
b6b3084ae7 | ||
|
|
f6a0f478c0 | ||
|
|
5cce412515 | ||
|
|
f9f881614b | ||
|
|
a76276787f
|
||
|
|
619bccdcf0 | ||
|
|
919589a397 | ||
|
|
bcf67ea71e | ||
|
|
674117e8ff | ||
|
|
1307fcd993 | ||
|
|
aeb92016c8 | ||
|
|
53ddd9413a | ||
|
|
791703e632 | ||
|
|
abec3883c7 | ||
|
|
c78e07cdca | ||
|
|
0b8ef99e8b | ||
|
|
82505437e1 | ||
|
|
510790dab3 | ||
|
|
3bbab5a037 | ||
|
|
53fbe8d8b1 | ||
|
|
660a58a94c | ||
|
|
0a4c0c7920 | ||
|
|
511fce32e1 | ||
|
|
7477dd929e
|
||
|
|
3b2528e447 | ||
|
|
628d5f68d3 | ||
|
|
b810402cea | ||
|
|
c18735eb92 | ||
|
|
b362af8bbe | ||
|
|
2ad082150d | ||
|
|
a2a06a49c9 | ||
|
|
c7765a7838 | ||
|
|
e37c082d0b | ||
|
|
fb4f0ebe44 | ||
|
|
adc0dbed67 | ||
|
|
43ef782b72 | ||
|
|
7c485ad14d | ||
|
|
70e6001c4a |
No files matched your search
+6
-16
@@ -1,28 +1,18 @@
|
|||||||
include:
|
include:
|
||||||
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
|
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
|
||||||
|
- project: unboundsoftware/ci-templates
|
||||||
|
file: Defaults.gitlab-ci.yml
|
||||||
- project: unboundsoftware/ci-templates
|
- project: unboundsoftware/ci-templates
|
||||||
file: Release.gitlab-ci.yml
|
file: Release.gitlab-ci.yml
|
||||||
|
- project: unboundsoftware/ci-templates
|
||||||
|
file: Pre-Commit-Go.gitlab-ci.yml
|
||||||
|
|
||||||
image: golang:1.23.2
|
image: amd64/golang:1.25.1@sha256:70de49a6a9bfd1bde2b332fde29d04a8cc65047464fa97ddb94251b05e572bc0
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- deps
|
- deps
|
||||||
- test
|
- test
|
||||||
|
|
||||||
run-pre-commit:
|
|
||||||
stage: .pre
|
|
||||||
image: unbound/pre-commit
|
|
||||||
variables:
|
|
||||||
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
|
|
||||||
cache:
|
|
||||||
- key:
|
|
||||||
files:
|
|
||||||
- .pre-commit-config.yaml
|
|
||||||
paths:
|
|
||||||
- ${PRE_COMMIT_HOME}
|
|
||||||
script:
|
|
||||||
- pre-commit run --all-files
|
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
stage: deps
|
stage: deps
|
||||||
script:
|
script:
|
||||||
@@ -42,7 +32,7 @@ test:
|
|||||||
|
|
||||||
vulnerabilities:
|
vulnerabilities:
|
||||||
stage: test
|
stage: test
|
||||||
image: golang:1.23.2
|
image: amd64/golang:1.25.1@sha256:70de49a6a9bfd1bde2b332fde29d04a8cc65047464fa97ddb94251b05e572bc0
|
||||||
script:
|
script:
|
||||||
- go install golang.org/x/vuln/cmd/govulncheck@latest
|
- go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||||
- govulncheck ./...
|
- govulncheck ./...
|
||||||
@@ -1,2 +1,22 @@
|
|||||||
|
version: "2"
|
||||||
run:
|
run:
|
||||||
allow-parallel-runners: true
|
allow-parallel-runners: true
|
||||||
|
linters:
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
presets:
|
||||||
|
- comments
|
||||||
|
- common-false-positives
|
||||||
|
- legacy
|
||||||
|
- std-error-handling
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
|
formatters:
|
||||||
|
exclusions:
|
||||||
|
generated: lax
|
||||||
|
paths:
|
||||||
|
- third_party$
|
||||||
|
- builtin$
|
||||||
|
- examples$
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
# See https://pre-commit.com/hooks.html for more hooks
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.6.0
|
rev: v6.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
@@ -18,7 +18,7 @@ repos:
|
|||||||
- --project
|
- --project
|
||||||
- unboundsoftware/shiny/authz_client
|
- unboundsoftware/shiny/authz_client
|
||||||
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
|
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
|
||||||
rev: v9.18.0
|
rev: v9.22.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: commitlint
|
- id: commitlint
|
||||||
stages: [ commit-msg ]
|
stages: [ commit-msg ]
|
||||||
@@ -37,10 +37,10 @@ repos:
|
|||||||
- id: go-test
|
- id: go-test
|
||||||
- id: gofumpt
|
- id: gofumpt
|
||||||
- repo: https://github.com/golangci/golangci-lint
|
- repo: https://github.com/golangci/golangci-lint
|
||||||
rev: v1.61.0
|
rev: v2.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: golangci-lint-full
|
- id: golangci-lint-full
|
||||||
- repo: https://github.com/gitleaks/gitleaks
|
- repo: https://github.com/gitleaks/gitleaks
|
||||||
rev: v8.20.0
|
rev: v8.28.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: gitleaks
|
- id: gitleaks
|
||||||
+56
-45
@@ -1,7 +1,31 @@
|
|||||||
# Changelog
|
## [0.3.0] - 2025-09-06
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
### 🚀 Features
|
||||||
|
|
||||||
|
- *(ci)* Add defaults pipeline template for CI workflow
|
||||||
|
- Add salary privilege to privilege management system
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/sparetimecoders/goamqp to v0.3.3
|
||||||
|
- *(deps)* Update module github.com/stretchr/testify to v1.11.0
|
||||||
|
- *(deps)* Update module github.com/stretchr/testify to v1.11.1
|
||||||
|
## [0.2.0] - 2025-04-11
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- Add timeout configuration to golangci-lint
|
||||||
|
- Add setup method for privilege event consumers
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(deps)* Update module github.com/stretchr/testify to v1.10.0
|
||||||
|
- *(ci)* Update go image to amd64 architecture version
|
||||||
|
- *(deps)* Update module github.com/sparetimecoders/goamqp to v0.3.2
|
||||||
|
|
||||||
|
### 🚜 Refactor
|
||||||
|
|
||||||
|
- *(ci)* Remove pre-commit job and add new template
|
||||||
## [0.1.4] - 2024-10-05
|
## [0.1.4] - 2024-10-05
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
@@ -9,6 +33,10 @@ All notable changes to this project will be documented in this file.
|
|||||||
- *(deps)* Update module github.com/stretchr/testify to v1.9.0
|
- *(deps)* Update module github.com/stretchr/testify to v1.9.0
|
||||||
- *(deps)* Update module github.com/sparetimecoders/goamqp to v0.3.1
|
- *(deps)* Update module github.com/sparetimecoders/goamqp to v0.3.1
|
||||||
|
|
||||||
|
### 💼 Other
|
||||||
|
|
||||||
|
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.2.1 to 0.3.0
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
- Update to Go 1.21.6
|
- Update to Go 1.21.6
|
||||||
@@ -17,17 +45,18 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Update golangci-lint to use full version
|
- Update golangci-lint to use full version
|
||||||
- Add release flow
|
- Add release flow
|
||||||
- Remove old release job
|
- Remove old release job
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.2.1 to 0.3.0
|
|
||||||
|
|
||||||
## [0.1.3] - 2023-12-26
|
## [0.1.3] - 2023-12-26
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- Prohibit concurrent read/write
|
- Prohibit concurrent read/write
|
||||||
|
|
||||||
|
### 💼 Other
|
||||||
|
|
||||||
|
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.4 to 0.1.5
|
||||||
|
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.5 to 0.2.0
|
||||||
|
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.2.0 to 0.2.1
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
- Update Go version
|
- Update Go version
|
||||||
@@ -39,31 +68,31 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Use 1.21.1 in go.mod for Dependabot
|
- Use 1.21.1 in go.mod for Dependabot
|
||||||
- Update to go 1.21.3 and remove patch level
|
- Update to go 1.21.3 and remove patch level
|
||||||
- Update version of Go
|
- Update version of Go
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.4 to 0.1.5
|
|
||||||
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.5 to 0.2.0
|
|
||||||
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.2.0 to 0.2.1
|
|
||||||
|
|
||||||
## [0.1.2] - 2023-06-04
|
## [0.1.2] - 2023-06-04
|
||||||
|
|
||||||
|
### 💼 Other
|
||||||
|
|
||||||
|
- *(deps)* Bump github.com/stretchr/testify from 1.8.2 to 1.8.3
|
||||||
|
- *(deps)* Bump github.com/stretchr/testify from 1.8.3 to 1.8.4
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
- Update pre-commit and fix golangci-lint
|
- Update pre-commit and fix golangci-lint
|
||||||
- Update golangci-lint
|
- Update golangci-lint
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
- *(deps)* Bump github.com/stretchr/testify from 1.8.2 to 1.8.3
|
|
||||||
- *(deps)* Bump github.com/stretchr/testify from 1.8.3 to 1.8.4
|
|
||||||
|
|
||||||
## [0.1.1] - 2023-05-11
|
## [0.1.1] - 2023-05-11
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- Run builds with Go 1.19.2 to fix vulnerabilities
|
- Run builds with Go 1.19.2 to fix vulnerabilities
|
||||||
|
|
||||||
|
### 💼 Other
|
||||||
|
|
||||||
|
- *(deps)* Bump github.com/stretchr/testify from 1.8.0 to 1.8.1
|
||||||
|
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.1 to 0.1.2
|
||||||
|
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.2 to 0.1.3
|
||||||
|
- *(deps)* Bump github.com/stretchr/testify from 1.8.1 to 1.8.2
|
||||||
|
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.3 to 0.1.4
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
- Add vulnerability-check
|
- Add vulnerability-check
|
||||||
@@ -77,29 +106,13 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Update Go verion for vulnerabilities scan
|
- Update Go verion for vulnerabilities scan
|
||||||
- Update to Go 1.20.3
|
- Update to Go 1.20.3
|
||||||
- Update Go version and fix gitlabci lint
|
- Update Go version and fix gitlabci lint
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
- *(deps)* Bump github.com/stretchr/testify from 1.8.0 to 1.8.1
|
|
||||||
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.1 to 0.1.2
|
|
||||||
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.2 to 0.1.3
|
|
||||||
- *(deps)* Bump github.com/stretchr/testify from 1.8.1 to 1.8.2
|
|
||||||
- *(deps)* Bump github.com/sparetimecoders/goamqp from 0.1.3 to 0.1.4
|
|
||||||
|
|
||||||
## [0.1.0] - 2022-07-20
|
## [0.1.0] - 2022-07-20
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- Pipeline
|
- Pipeline
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
### 💼 Other
|
||||||
|
|
||||||
- Add dependabot config
|
|
||||||
- Remove dependabot-standalone
|
|
||||||
- Change to codecov binary instead of bash uploader
|
|
||||||
- Switch to moved goamqp
|
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
- Add params to codecov
|
- Add params to codecov
|
||||||
- *(deps)* Bump github.com/stretchr/testify from 1.7.0 to 1.7.1
|
- *(deps)* Bump github.com/stretchr/testify from 1.7.0 to 1.7.1
|
||||||
@@ -109,6 +122,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
- *(deps)* Bump github.com/stretchr/testify from 1.7.4 to 1.7.5
|
- *(deps)* Bump github.com/stretchr/testify from 1.7.4 to 1.7.5
|
||||||
- *(deps)* Bump github.com/stretchr/testify from 1.7.5 to 1.8.0
|
- *(deps)* Bump github.com/stretchr/testify from 1.7.5 to 1.8.0
|
||||||
|
|
||||||
|
### ⚙️ Miscellaneous Tasks
|
||||||
|
|
||||||
|
- Add dependabot config
|
||||||
|
- Remove dependabot-standalone
|
||||||
|
- Change to codecov binary instead of bash uploader
|
||||||
|
- Switch to moved goamqp
|
||||||
## [0.0.8] - 2021-05-15
|
## [0.0.8] - 2021-05-15
|
||||||
|
|
||||||
### ⚙️ Miscellaneous Tasks
|
### ⚙️ Miscellaneous Tasks
|
||||||
@@ -120,7 +139,6 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Rename master -> main
|
- Rename master -> main
|
||||||
- Group imports
|
- Group imports
|
||||||
- Update to latest version of goamqp
|
- Update to latest version of goamqp
|
||||||
|
|
||||||
## [0.0.7] - 2020-04-12
|
## [0.0.7] - 2020-04-12
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
@@ -128,7 +146,6 @@ All notable changes to this project will be documented in this file.
|
|||||||
- Update to Go 1.14 to fix test errors
|
- Update to Go 1.14 to fix test errors
|
||||||
- Use go mod download
|
- Use go mod download
|
||||||
- Sort companies before comparing since map-iteration is not stable
|
- Sort companies before comparing since map-iteration is not stable
|
||||||
|
|
||||||
## [0.0.6] - 2020-04-12
|
## [0.0.6] - 2020-04-12
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
@@ -139,25 +156,21 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
- Add tests
|
- Add tests
|
||||||
- Modify event structure
|
- Modify event structure
|
||||||
|
|
||||||
## [0.0.5] - 2019-12-31
|
## [0.0.5] - 2019-12-31
|
||||||
|
|
||||||
### 🚀 Features
|
### 🚀 Features
|
||||||
|
|
||||||
- Add handling of removed privilege
|
- Add handling of removed privilege
|
||||||
|
|
||||||
## [0.0.4] - 2019-12-08
|
## [0.0.4] - 2019-12-08
|
||||||
|
|
||||||
### 🚀 Features
|
### 🚀 Features
|
||||||
|
|
||||||
- Add name and registration number to event
|
- Add name and registration number to event
|
||||||
|
|
||||||
## [0.0.3] - 2019-11-22
|
## [0.0.3] - 2019-11-22
|
||||||
|
|
||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- Print unexpected messages
|
- Print unexpected messages
|
||||||
|
|
||||||
## [0.0.2] - 2019-11-06
|
## [0.0.2] - 2019-11-06
|
||||||
|
|
||||||
### 🚀 Features
|
### 🚀 Features
|
||||||
@@ -167,5 +180,3 @@ All notable changes to this project will be documented in this file.
|
|||||||
### 🐛 Bug Fixes
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
- Rename module
|
- Rename module
|
||||||
|
|
||||||
<!-- generated by git-cliff -->
|
|
||||||
@@ -20,6 +20,7 @@ type CompanyPrivileges struct {
|
|||||||
Invoicing bool `json:"invoicing"`
|
Invoicing bool `json:"invoicing"`
|
||||||
Accounting bool `json:"accounting"`
|
Accounting bool `json:"accounting"`
|
||||||
Supplier bool `json:"supplier"`
|
Supplier bool `json:"supplier"`
|
||||||
|
Salary bool `json:"salary"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrivilegeHandler processes PrivilegeAdded-events and fetches the initial set of privileges from an authz-service
|
// PrivilegeHandler processes PrivilegeAdded-events and fetches the initial set of privileges from an authz-service
|
||||||
@@ -75,6 +76,15 @@ func (h *PrivilegeHandler) Fetch() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *PrivilegeHandler) Setup() []goamqp.Setup {
|
||||||
|
return []goamqp.Setup{
|
||||||
|
goamqp.TransientEventStreamConsumer("User.Added", h.Process, UserAdded{}),
|
||||||
|
goamqp.TransientEventStreamConsumer("User.Removed", h.Process, UserRemoved{}),
|
||||||
|
goamqp.TransientEventStreamConsumer("Privilege.Added", h.Process, PrivilegeAdded{}),
|
||||||
|
goamqp.TransientEventStreamConsumer("Privilege.Removed", h.Process, PrivilegeRemoved{}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Process privilege-related events and update the internal state
|
// Process privilege-related events and update the internal state
|
||||||
func (h *PrivilegeHandler) Process(msg interface{}, _ goamqp.Headers) (interface{}, error) {
|
func (h *PrivilegeHandler) Process(msg interface{}, _ goamqp.Headers) (interface{}, error) {
|
||||||
switch ev := msg.(type) {
|
switch ev := msg.(type) {
|
||||||
@@ -130,6 +140,8 @@ func (h *PrivilegeHandler) setPrivileges(email, companyId string, privilege Priv
|
|||||||
c.Accounting = set
|
c.Accounting = set
|
||||||
case PrivilegeSupplier:
|
case PrivilegeSupplier:
|
||||||
c.Supplier = set
|
c.Supplier = set
|
||||||
|
case PrivilegeSalary:
|
||||||
|
c.Salary = set
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
priv[companyId] = &CompanyPrivileges{}
|
priv[companyId] = &CompanyPrivileges{}
|
||||||
|
|||||||
+15
-1
@@ -236,6 +236,18 @@ func TestPrivilegeHandler_IsAllowed_Return_True_If_Privilege_Exists(t *testing.T
|
|||||||
})
|
})
|
||||||
|
|
||||||
assert.True(t, result)
|
assert.True(t, result)
|
||||||
|
|
||||||
|
_, _ = handler.Process(&PrivilegeAdded{
|
||||||
|
Email: "jim@example.org",
|
||||||
|
CompanyID: "abc-123",
|
||||||
|
Privilege: PrivilegeSalary,
|
||||||
|
}, goamqp.Headers{})
|
||||||
|
|
||||||
|
result = handler.IsAllowed("jim@example.org", "abc-123", func(privileges CompanyPrivileges) bool {
|
||||||
|
return privileges.Salary
|
||||||
|
})
|
||||||
|
|
||||||
|
assert.True(t, result)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrivilegeHandler_Fetch_Error_Response(t *testing.T) {
|
func TestPrivilegeHandler_Fetch_Error_Response(t *testing.T) {
|
||||||
@@ -289,7 +301,8 @@ func TestPrivilegeHandler_Fetch_Valid(t *testing.T) {
|
|||||||
"time": true,
|
"time": true,
|
||||||
"invoicing": true,
|
"invoicing": true,
|
||||||
"accounting": false,
|
"accounting": false,
|
||||||
"supplier": false
|
"supplier": false,
|
||||||
|
"salary": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
@@ -313,6 +326,7 @@ func TestPrivilegeHandler_Fetch_Valid(t *testing.T) {
|
|||||||
Invoicing: true,
|
Invoicing: true,
|
||||||
Accounting: false,
|
Accounting: false,
|
||||||
Supplier: false,
|
Supplier: false,
|
||||||
|
Salary: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const (
|
|||||||
PrivilegeInvoicing = "INVOICING"
|
PrivilegeInvoicing = "INVOICING"
|
||||||
PrivilegeAccounting = "ACCOUNTING"
|
PrivilegeAccounting = "ACCOUNTING"
|
||||||
PrivilegeSupplier = "SUPPLIER"
|
PrivilegeSupplier = "SUPPLIER"
|
||||||
|
PrivilegeSalary = "SALARY"
|
||||||
)
|
)
|
||||||
|
|
||||||
var AllPrivilege = []Privilege{
|
var AllPrivilege = []Privilege{
|
||||||
@@ -33,11 +34,12 @@ var AllPrivilege = []Privilege{
|
|||||||
PrivilegeInvoicing,
|
PrivilegeInvoicing,
|
||||||
PrivilegeAccounting,
|
PrivilegeAccounting,
|
||||||
PrivilegeSupplier,
|
PrivilegeSupplier,
|
||||||
|
PrivilegeSalary,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e Privilege) IsValid() bool {
|
func (e Privilege) IsValid() bool {
|
||||||
switch e {
|
switch e {
|
||||||
case PrivilegeAdmin, PrivilegeCompany, PrivilegeConsumer, PrivilegeTime, PrivilegeInvoicing, PrivilegeAccounting, PrivilegeSupplier:
|
case PrivilegeAdmin, PrivilegeCompany, PrivilegeConsumer, PrivilegeTime, PrivilegeInvoicing, PrivilegeAccounting, PrivilegeSupplier, PrivilegeSalary:
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
module gitlab.com/unboundsoftware/shiny/authz_client
|
module gitlab.com/unboundsoftware/shiny/authz_client
|
||||||
|
|
||||||
go 1.21
|
go 1.22.12
|
||||||
|
|
||||||
|
toolchain go1.25.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/sparetimecoders/goamqp v0.3.1
|
github.com/sparetimecoders/goamqp v0.3.3
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.11.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
||||||
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
||||||
github.com/sparetimecoders/goamqp v0.3.1 h1:NCzdyAz84G679HlO+ivhyoI1aMgXEe3qfqpn4EChu1s=
|
github.com/sparetimecoders/goamqp v0.3.3 h1:z/nfTPmrjeU/rIVuNOgsVLCimp3WFoNFvS3ZzXRJ6HE=
|
||||||
github.com/sparetimecoders/goamqp v0.3.1/go.mod h1:PjkgrmsuMVgRbiQDTLs0pCWYrcQgqcUee38JjCDZdlk=
|
github.com/sparetimecoders/goamqp v0.3.3/go.mod h1:W9NRCpWLE+Vruv2dcRSbszNil2O826d2Nv6kAkETW5o=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
|
|||||||
Reference in new issue
Block a user