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
HBASE-25160 Refactor AccessController and VisibilityController #2506
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -429,7 +429,6 @@ private enum OpType { | |
DELETE("delete"), | ||
CHECK_AND_PUT("checkAndPut"), | ||
CHECK_AND_DELETE("checkAndDelete"), | ||
INCREMENT_COLUMN_VALUE("incrementColumnValue"), | ||
APPEND("append"), | ||
INCREMENT("increment"); | ||
|
||
|
@@ -1503,18 +1502,27 @@ public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, | |
// We have a failure with table, cf and q perm checks and now giving a chance for cell | ||
// perm check | ||
OpType opType; | ||
long timestamp; | ||
if (m instanceof Put) { | ||
checkForReservedTagPresence(user, m); | ||
opType = OpType.PUT; | ||
timestamp = m.getTimestamp(); | ||
} else if (m instanceof Delete) { | ||
opType = OpType.DELETE; | ||
timestamp = m.getTimestamp(); | ||
} else if (m instanceof Increment) { | ||
opType = OpType.INCREMENT; | ||
timestamp = ((Increment) m).getTimeRange().getMax(); | ||
} else if (m instanceof Append) { | ||
opType = OpType.APPEND; | ||
timestamp = ((Append) m).getTimeRange().getMax(); | ||
} else { | ||
// If the operation type is not Put or Delete, do nothing | ||
// If the operation type is not Put/Delete/Increment/Append, do nothing | ||
continue; | ||
} | ||
AuthResult authResult = null; | ||
if (checkCoveringPermission(user, opType, c.getEnvironment(), m.getRow(), | ||
m.getFamilyCellMap(), m.getTimestamp(), Action.WRITE)) { | ||
m.getFamilyCellMap(), timestamp, Action.WRITE)) { | ||
authResult = AuthResult.allow(opType.toString(), "Covering cell set", | ||
user, Action.WRITE, table, m.getFamilyCellMap()); | ||
} else { | ||
|
@@ -1695,32 +1703,6 @@ public Result preAppend(ObserverContext<RegionCoprocessorEnvironment> c, Append | |
return null; | ||
} | ||
|
||
@Override | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not used any more? |
||
public Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c, | ||
final Append append) throws IOException { | ||
if (append.getAttribute(CHECK_COVERING_PERM) != null) { | ||
// We had failure with table, cf and q perm checks and now giving a chance for cell | ||
// perm check | ||
TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable(); | ||
AuthResult authResult = null; | ||
User user = getActiveUser(c); | ||
if (checkCoveringPermission(user, OpType.APPEND, c.getEnvironment(), append.getRow(), | ||
append.getFamilyCellMap(), append.getTimeRange().getMax(), Action.WRITE)) { | ||
authResult = AuthResult.allow(OpType.APPEND.toString(), | ||
"Covering cell set", user, Action.WRITE, table, append.getFamilyCellMap()); | ||
} else { | ||
authResult = AuthResult.deny(OpType.APPEND.toString(), | ||
"Covering cell set", user, Action.WRITE, table, append.getFamilyCellMap()); | ||
} | ||
AccessChecker.logResult(authResult); | ||
if (authorizationEnabled && !authResult.isAllowed()) { | ||
throw new AccessDeniedException("Insufficient permissions " + | ||
authResult.toContextString()); | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> c, | ||
final Increment increment) | ||
|
@@ -1756,32 +1738,6 @@ public Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> c | |
return null; | ||
} | ||
|
||
@Override | ||
public Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto? |
||
final Increment increment) throws IOException { | ||
if (increment.getAttribute(CHECK_COVERING_PERM) != null) { | ||
// We had failure with table, cf and q perm checks and now giving a chance for cell | ||
// perm check | ||
TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable(); | ||
AuthResult authResult = null; | ||
User user = getActiveUser(c); | ||
if (checkCoveringPermission(user, OpType.INCREMENT, c.getEnvironment(), increment.getRow(), | ||
increment.getFamilyCellMap(), increment.getTimeRange().getMax(), Action.WRITE)) { | ||
authResult = AuthResult.allow(OpType.INCREMENT.toString(), "Covering cell set", | ||
user, Action.WRITE, table, increment.getFamilyCellMap()); | ||
} else { | ||
authResult = AuthResult.deny(OpType.INCREMENT.toString(), "Covering cell set", | ||
user, Action.WRITE, table, increment.getFamilyCellMap()); | ||
} | ||
AccessChecker.logResult(authResult); | ||
if (authorizationEnabled && !authResult.isAllowed()) { | ||
throw new AccessDeniedException("Insufficient permissions " + | ||
authResult.toContextString()); | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Pair<Cell, Cell>> postIncrementBeforeWAL( | ||
ObserverContext<RegionCoprocessorEnvironment> ctx, Mutation mutation, | ||
|
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
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.
This is not used anymore? Is this feature no longer in place?