Repository navigation
[CXH-3520] - Make site role Grant and Revoke state-aware - #56
Conversation
c2aab5d to
42f1601
Compare
…eplaced-role annotation
…p and admin-policy tests/docs
3398f7e to
221aaf0
Compare
|
[Minor] Site-role writes do not update the license grant
A site-role write changes the license tier, but no license grant is updated. A site-role Grant of Creator to a user with a Viewer license emits The two exclusion groups ( Suggestion: state this as a known limitation in the README and connector docs. Alternatively, emit the matching license |
|
[Minor]
The text still says "Grant: Update a user's site role / Revoke: Set a user's site role to Unlicensed". It omits the uncached read, the no-op annotations, the ServerAdministrator refusal, and the exclusion group. PR #55 updated this file for licenses. The three doc surfaces now disagree for site roles. Suggestion: update this section to match the README and |
|
[Minor] No guard against self-lockout of the connector account
Nothing stops the connector from removing its own admin rights. Assume the PAT owner is Suggestion: refuse a demotion of the authenticated user with |
|
[Minor] Exclusion group has no default and no order
Revoke always writes Unlicensed, but C1 does not know that Unlicensed is the fallback. C1 can show a user with no site role. Suggestion: if the team wants this, add it now. A later addition is another C1 migration. |
|
[Minor] PUT rate-limit annotations are dropped on error
Suggestion: return |
luisina-santos
left a comment
There was a problem hiding this comment.
docs/docs-info.md still describes the old behavior (Provisioning section: "Revoke: Set a user's site role to Unlicensed") and doesn't mention the no-op cases or the ServerAdministrator guard. Please update it to match the new Site roles section in connector.mdx.
…ewriting-the-site-role-of-a' into sergiocorral/cxh-3520-site-role-provisioning
…tations on write failures
…ow revoking ServerAdministrator
… exclusion groups
…ault Unlicensed and known limitation
…-the-site-role-of-a into sergiocorral/cxh-3520-site-role-provisioning
|
Thanks @johnallers and @luisina-santos. Addressed in this round:
|
…ewriting-the-site-role-of-a' into sergiocorral/cxh-3520-site-role-provisioning
| group = ent.WithExclusionGroupDefault(siteRoleExclusionGroup(resource), 0) | ||
| } | ||
| permissionOptions := []ent.EntitlementOption{ | ||
| ent.WithGrantableTo(resourceTypeUser), |
There was a problem hiding this comment.
WithGrantableTo(resourceTypeUser) is applied to all nine roles, so server administrator is advertised as a grantable entitlement — and this PR now also puts it in the mandatory site-role:<siteID> group. But Grant rejects it unconditionally at line 186 (nonGrantableRoles), so every access request for "Site Server Administrator" in C1 fails, and nothing self-heals on the next sync.
The grantable side predates this PR; it becomes worth fixing here because these are the lines that add the entitlement to the exclusion group.
Suggestion
Drop ServerAdministrator from the grantable set and mark its sync grants immutable instead, so C1 never offers the operation:
if nonGrantableRoles[apiRole] {
grantOpts = append(grantOpts, grant.WithAnnotation(&v2.GrantImmutable{}))
}See also
- This repo already does exactly this for the "All Users" group in
pkg/connector/group.go:126-131 - Sibling: baton-box
role.go#L120-L124— same pattern for a role the connector will not provision GrantImmutablewould also stop C1 dispatching a Revoke of a heldServerAdministrator; I am not reopening that policy, which you documented, but it is worth weighing while you are here.
INTENT
GrantandRevokeread the current role without the cache before writing.docs/connector.mdxdescribe the resulting behavior.Fixes CXH-3520
What and why
GrantAlreadyExists); missing-user, stale-role and held-Unlicensed Revoke are no-ops (GrantAlreadyRevoked), with no PUT.GrantReplacedfor the prior site-role grant only after a successful write. A held licensed role is revoked to Unlicensed.FailedPrecondition, no PUT). The connector does not assign that server-wide role; this is an explicit protection policy, not a claim that the API itself rejects such changes.WithExclusionGroupto Site Role entitlements. Entitlement/grant IDs are unchanged; this does not assert automatic cleanup of historical C1 assignments.Dependency / review scope
Stacked on #55 at
42f1601b: it supplies the shared uncachedGetUser,IsNotFoundErrorand annotation-merging helper. This diff contains only the Site Role follow-up (5 files). The stack isstaging→ #55 → #56; #55 targetsstaging. Rebased the four Site Role commits onto the updated #55 head; no license commits were replayed, and the Site Role patch is unchanged.How tested
Rebased head
221aaf01:go build ./...,go test ./... -count=1andgo vet ./...pass. Local golangci-lint is unavailable; CI lint passes. All 5 executed checks pass (lint, tests, docs and metadata); 3 jobs are skipped. The added/removed lines match the previous Site Role-only patch exactly.Before rebase, head
3398f7e5: build, full unit suite, vet and golangci-lint v2.14.0 passed. Includes [CXH-2368] - Fix license grant rewriting the site role of a user who already holds the tier #55's license materialization regression. The Site Role update is comments/docs only; affected README text was reduced from 228 to 198 words, the Site roles docs section from 244 to 212, with existing policies retained. No new live provisioning run.go build ./...,go vet ./...,go test ./... -count=1: pass. Capabilities regenerated from the binary and unchanged.Stateful mock tests cover exact no-ops, replacements, administrative guards, deleted users, read/write failures and one-client sequences with external role changes. Removing
WithNoCachemakes the cache-sensitive regression tests fail; restored source passes.Live on a non-production Tableau Cloud trial, commit
43cf3e4d: 12 Grant/Revoke scenarios pass, with independent REST role read-back after every action (Creator, Unlicensed and SiteAdministratorCreator, including stale revokes and deleted users).Two baseline syncs pass (28 resources / 269 entitlements / 534 grants); all 9 Site Role entitlements have the exclusion annotation; site entitlement/grant IDs are stable.
One temporary reserved-domain fixture was created, restored to Unlicensed and deleted. Final tenant state matches baseline: one operator user still SiteAdministratorCreator; operator account and license configuration untouched.
Containerization audit: platform confirms deployment support, not excluded, field mapping and admin registration present; already containerized. No containerization changes included.
Verification limits
453b91b1, and lint/tests/docs/metadata passed on that revision. No module downgrade or global config changes. Integration/regression were skipped; version checks and automated review did not run against the stacked base.🤖 Generated with AI