Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5018: Add permission check for database altering before allowing user…
… to install SQL Server node with log-based replication (#159) * 5018: add permission check for altering databases to wizard for sql server log-based repl * 5018: add permission check for altering databases to wizard for sql server log-based repl
- Loading branch information
Showing
2 changed files
with
16 additions
and
2 deletions.
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/.DS_Store | ||
/.project | ||
*.iml | ||
|
||
.clover/* | ||
/.idea/* | ||
*.ipr | ||
*.iws |
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 |
---|---|---|
|
@@ -72,8 +72,22 @@ public long getEstimatedRowCount(Table table) { | |
@Override | ||
protected PermissionResult getLogMinePermission() { | ||
final PermissionResult result = new PermissionResult(PermissionType.LOG_MINE, ""); | ||
result.setStatus(Status.PASS); | ||
try { | ||
if (getSqlTemplate().queryForInt("SELECT COUNT(*) FROM fn_my_permissions(NULL, 'SERVER') WHERE permission_name='ALTER'") > 0) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rudiejd
Author
Contributor
|
||
result.setStatus(Status.PASS); | ||
} else { | ||
result.setStatus(Status.FAIL); | ||
result.setSolution("Grant alter any database to this user."); | ||
} | ||
|
||
} catch (Exception e) { | ||
result.setSolution("Error occurred checking user permissions"); | ||
result.setException(e); | ||
} | ||
return result; | ||
} | ||
|
||
|
||
|
||
|
||
} |
@rudiejd
We are trying to build a POC and can not use Log based on 3.12.11 because of permissions. Should the where clause not be
where permission_name='ALTER ANY DATABASE'?