-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#2869] feat(core): Add the core logic of authorization #3050
Open
qqqttt123
wants to merge
79
commits into
apache:main
Choose a base branch
from
qqqttt123:ISSUE-2869-4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
85c56aa
Supports multiple securable objects
2dab53a
Remove limit
f97d872
Remove blank
4ebe2ce
Update SQL script
f8d0649
Modify document and add upgrade script
65108ca
Add new uts
d71132f
fix style
68a2cd4
Change type
1487d89
Add fields
927ec29
Use another table to store securable objects
80a3335
Merge remote-tracking branch 'upstream/main' into ISSUE-3343
dd237ba
Commit information
89c3e42
Commit information
7a55a0e
Change to MetadataObject.Type
f079305
fix style
1891cec
Change SecurableObject type
a2f8d5f
Update SQL
8a95066
Revert "Add fields"
0e3fb3d
format
e0a33b1
format
75d92c3
format
d351ae7
Data migiration
6ff647e
Add auto increment
1e0da55
Address comments
e145558
Use entity id
c290088
Add mapper
8484d04
Use entityId
d73248f
Fix tests
aa432bd
fix comment
435c334
rename
5463b4a
Remove dirty logic from POConverts
eb94073
Add more uts
2dba190
Merge remote-tracking branch 'upstream/main' into ISSUE-3343
32c5eca
fix compile
0be53e7
fix compile
4f84ac2
Address comments
46d620e
fix tests
9a3ed93
[#2869] feat(server): Add the authorization for admins
12c59ef
Remove supportsSecurableObjectType
2d85afc
Remove more filters
736e5bc
Remove unused methods
eb627e2
Left imports
51d7efd
address comments
e9317aa
Address comments
c191142
Add comment
a021351
Add comment
edc15ef
address comments
48a1ac8
Add ut
8510093
Merge remote-tracking branch 'upstream/main' into ISSUE-2869-4
d1fc027
add ut
140ad19
Address comments
168919d
Address comments
ec41730
fix style
033ec85
fix ut
3719280
remove extra blank
85fbb8a
Merge branch 'ISSUE-3343' into ISSUE-2869-4
44abe05
ut
0ead8f9
Add ut
jerqi 13a5f57
Merge remote-tracking branch 'upstream/main' into ISSUE-2869-4
jerqi c6fd30a
fix ut
jerqi 4396e35
fix ut
jerqi 0bd0a6c
fix ut
jerqi 1c4c896
fix ut
jerqi 3426521
Address comments
jerqi a522cde
Merge remote-tracking branch 'upstream/main' into ISSUE-2869-4
jerqi 280d716
fix style
jerqi bbfbb11
fix ut
jerqi 6463b3f
address comments
jerqi bd240ce
Merge remote-tracking branch 'upstream/main' into ISSUE-2869-4
jerqi a3ad730
fix conflicts
jerqi 319a91f
address comments
jerqi f39f262
Add ut
jerqi c23924a
Remove todo
jerqi 3dc29ed
fix style
jerqi 940ea14
fix ut
jerqi 31a3a2b
address comments
jerqi a714cdd
refactor another class
jerqi b7c30fa
fix ut
jerqi bd54c41
Remove admin filter
jerqi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
api/src/main/java/com/datastrato/gravitino/exceptions/ForbiddenException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2024 Datastrato Pvt Ltd. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
package com.datastrato.gravitino.exceptions; | ||
|
||
import com.google.errorprone.annotations.FormatMethod; | ||
import com.google.errorprone.annotations.FormatString; | ||
|
||
/** Exception thrown when a user doesn't have the privilege to perform an action. */ | ||
public class ForbiddenException extends GravitinoRuntimeException { | ||
|
||
/** | ||
* Constructs a new exception with the specified detail message. | ||
* | ||
* @param message the detail message. | ||
* @param args the arguments to the message. | ||
*/ | ||
@FormatMethod | ||
public ForbiddenException(@FormatString String message, Object... args) { | ||
super(message, args); | ||
} | ||
|
||
/** | ||
* Constructs a new exception with the specified detail message and cause. | ||
* | ||
* @param cause the cause. | ||
* @param message the detail message. | ||
* @param args the arguments to the message. | ||
*/ | ||
@FormatMethod | ||
public ForbiddenException(Throwable cause, @FormatString String message, Object... args) { | ||
super(cause, message, args); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
api/src/main/java/com/datastrato/gravitino/exceptions/PrivilegesAlreadyGrantedException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2024 Datastrato Pvt Ltd. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
package com.datastrato.gravitino.exceptions; | ||
|
||
import com.google.errorprone.annotations.FormatMethod; | ||
import com.google.errorprone.annotations.FormatString; | ||
|
||
/** An exception thrown when privileges already exist. */ | ||
public class PrivilegesAlreadyGrantedException extends AlreadyExistsException { | ||
/** | ||
* Constructs a new exception with the specified detail message. | ||
* | ||
* @param message the detail message. | ||
* @param args the arguments to the message. | ||
*/ | ||
@FormatMethod | ||
public PrivilegesAlreadyGrantedException(@FormatString String message, Object... args) { | ||
super(message, args); | ||
} | ||
|
||
/** | ||
* Constructs a new exception with the specified detail message and cause. | ||
* | ||
* @param cause the cause. | ||
* @param message the detail message. | ||
* @param args the arguments to the message. | ||
*/ | ||
@FormatMethod | ||
public PrivilegesAlreadyGrantedException( | ||
Throwable cause, @FormatString String message, Object... args) { | ||
super(cause, message, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There you mentioned that "You can give the securable object the privileges
CREATE METALAKE
", but here you mentioned that "You can't grant any privilege to this securable object". I think these two sentences are self-contradictory, you should have a more accurate description.Besides, why you can't bind this securable object to a role?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, for users, users can't grant any privilege to allMetalakes. But system pre-created a role binds allMetalakes. AllMetalakes isn't used for the normal user.
We shouldn't allow user to use allMetalakes. It can inflluence the privileges of all metalakes.It's too dangerous.