mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-2571 fix auth role context
This commit is contained in:
+1
-1
@@ -161,7 +161,7 @@ public class WebSessionAuthProcessor {
|
||||
providerConfig,
|
||||
authAttrs);
|
||||
|
||||
if (!configMode && securityController.getUserPermissions(userId, authInfo.getAuthRole()).isEmpty()) {
|
||||
if (!configMode && securityController.getUserPermissions(userId).isEmpty()) {
|
||||
throw new DBWebException("Access denied (no permissions)");
|
||||
}
|
||||
if (!configMode && !securityController.getUserById(userId).isEnabled()) {
|
||||
|
||||
+6
-2
@@ -821,7 +821,7 @@ public class CBEmbeddedSecurityController implements SMAdminController, SMAuthen
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<String> getUserPermissions(String userId, String authRole) throws DBException {
|
||||
public Set<String> getUserPermissions(String userId) throws DBException {
|
||||
try (Connection dbCon = database.openConnection()) {
|
||||
Set<String> permissions = new HashSet<>();
|
||||
try (PreparedStatement dbStat = dbCon.prepareStatement(
|
||||
@@ -849,6 +849,10 @@ public class CBEmbeddedSecurityController implements SMAdminController, SMAuthen
|
||||
}
|
||||
}
|
||||
|
||||
protected Set<String> getUserPermissions(String userId, String authRole) throws DBException {
|
||||
return getUserPermissions(userId);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Sessions
|
||||
|
||||
@@ -1547,7 +1551,7 @@ public class CBEmbeddedSecurityController implements SMAdminController, SMAuthen
|
||||
} catch (SQLException e) {
|
||||
throw new DBCException("Error reading token info in database", e);
|
||||
}
|
||||
var permissions = userId == null ? getAnonymousUserPermissions() : getUserPermissions(userId, authRole);
|
||||
var permissions = userId == null ? getAnonymousUserPermissions() : getUserPermissions(userId);
|
||||
return new SMAuthPermissions(userId, sessionId, permissions);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user