Skip to content

jobs: add VIEWJOB global privilege, remove role option#97860

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
jayshrivastava:jobs-global-privs
Mar 9, 2023
Merged

jobs: add VIEWJOB global privilege, remove role option#97860
craig[bot] merged 1 commit intocockroachdb:masterfrom
jayshrivastava:jobs-global-privs

Conversation

@jayshrivastava
Copy link
Copy Markdown
Contributor

@jayshrivastava jayshrivastava commented Mar 1, 2023

This change updates VIEWJOB to be a global privilege instead of a role option so that it can be inherited from roles to their members.

Previously, VIEWJOB was a role option which could be granted to users. Now, VIEWJOB is a global privilege. Granting this privilege to a user or role has the syntax GRANT SYSTEM VIEWJOB TO user. Using VIEWJOB as a role option is deprecated.

Note that the VIEWJOB role option was not included in any release so far. It was queued up to be released in 23.1, but was not. This change is also being queued for 23.1, so there should not be any backwards compatibility issues.

Informs: #96382
Epic: None
Release Note: None

@blathers-crl
Copy link
Copy Markdown

blathers-crl bot commented Mar 1, 2023

It looks like your PR touches SQL parser code but doesn't add or edit parser tests. Please make sure you add or edit parser tests if you edit the parser.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@jayshrivastava jayshrivastava force-pushed the jobs-global-privs branch 5 times, most recently from 3ce252f to 700abe3 Compare March 1, 2023 18:58
@jayshrivastava jayshrivastava requested a review from rafiss March 1, 2023 18:58
@jayshrivastava jayshrivastava marked this pull request as ready for review March 1, 2023 18:58
@jayshrivastava jayshrivastava requested a review from a team as a code owner March 1, 2023 18:58
@jayshrivastava jayshrivastava requested review from a team March 1, 2023 18:58
@jayshrivastava jayshrivastava force-pushed the jobs-global-privs branch 2 times, most recently from 5d59c41 to 694a3d5 Compare March 1, 2023 19:41
Copy link
Copy Markdown
Contributor

@miretskiy miretskiy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG from cdc side, but do get a 👍 from @rafiss before merging

Copy link
Copy Markdown
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thanks for doing this change. just had a very small nit

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @jayshrivastava)


-- commits line 8 at r1:
nit: for cases like this, where the commit is changing something that never appeared in any release, it's best to not include a release note. the reason being, someone reading our public docs would likely just end up more confused after reading this, since it is impossible for them to have been affected.

the info here is still great for the commit message though, just no need for a release note.


-- commits line 19 at r1:
looks like this should resolve https://cockroachlabs.atlassian.net/browse/CRDB-10082 as well


pkg/jobs/jobsauth/authorization.go line 62 at r1 (raw file):

	// HasPrivilege mirrors sql.AuthorizationAccessor.
	HasPrivilege(ctx context.Context, privilegeObject privilege.Object, privilege privilege.Kind, user username.SQLUsername) (bool, error)

nice, thanks! i've been meaning to add this function to this interface


pkg/sql/roleoption/role_option.go line 37 at r1 (raw file):

// KindList of role options.
//
// NOTE: Before adding a role option (especially a non-postgres one), consider

+1 thanks for adding this note too!

Copy link
Copy Markdown
Contributor Author

@jayshrivastava jayshrivastava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TYFR!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @rafiss)


-- commits line 8 at r1:

Previously, rafiss (Rafi Shamim) wrote…

nit: for cases like this, where the commit is changing something that never appeared in any release, it's best to not include a release note. the reason being, someone reading our public docs would likely just end up more confused after reading this, since it is impossible for them to have been affected.

the info here is still great for the commit message though, just no need for a release note.

ack!

@jayshrivastava jayshrivastava force-pushed the jobs-global-privs branch 3 times, most recently from 29a3b93 to f61eba9 Compare March 9, 2023 16:28
This change updates `VIEWJOB` to be a global privilege instead
of a role option so that it can be inherited from roles to
their members.

Previously, `VIEWJOB` was a role option which could be granted to users.
Now, `VIEWJOB` is a global privilege. Granting this privilege to a user
or role has the syntax `GRANT SYSTEM VIEWJOB TO user`. Using `VIEWJOB`
as a role option is deprecated.

Note that the `VIEWJOB` role option was not included in any release so far.
It was queued up to be released in 23.1, but was not. This change
is also being queued for 23.1, so there should not be any backwards
compatibility issues.

Informs: cockroachdb#96382
Epic: none
Release note: None
@jayshrivastava
Copy link
Copy Markdown
Contributor Author

bors r+

@craig craig bot merged commit 6f444d4 into cockroachdb:master Mar 9, 2023
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Mar 9, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants