Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,143 changes: 1,071 additions & 72 deletions pkg/frontend/authenticate.go

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion pkg/frontend/authenticate2.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package frontend

import (
"context"
"strings"

"github.com/matrixorigin/matrixone/pkg/catalog"
"github.com/matrixorigin/matrixone/pkg/pb/plan"
Expand Down Expand Up @@ -59,6 +60,7 @@ func verifyLightPrivilege(ses *Session,
if len(dbName) == 0 {
dbName = ses.GetDatabaseName()
}
dbName = strings.ToLower(dbName)
if ok2 := isBannedDatabase(dbName); ok2 {
if isClusterTable {
ok = verifyAccountCanOperateClusterTable(ses.GetTenantInfo(), dbName, clusterTableOperation)
Expand Down Expand Up @@ -170,6 +172,9 @@ var checkPrivilegeInCache = func(ctx context.Context, ses *Session, priv *privil
// }
yes = false
} else {
if len(mi.originViews) > 0 || mi.directView != "" {
return false, nil
}
tempEntry := privilegeEntriesMap[mi.privilegeTyp]
tempEntry.databaseName = mi.dbName
tempEntry.tableName = mi.tableName
Expand All @@ -180,9 +185,13 @@ var checkPrivilegeInCache = func(ctx context.Context, ses *Session, priv *privil
return false, err
}

writeDirectly := priv.writeDatabaseAndTableDirectly
if (tempEntry.objType == objectTypeTable || tempEntry.objType == objectTypeView) && mi.privilegeTyp == PrivilegeTypeSelect {
writeDirectly = false
}
yes2 = verifyLightPrivilege(ses,
tempEntry.databaseName,
priv.writeDatabaseAndTableDirectly,
writeDirectly,
mi.isClusterTable,
mi.clusterTableOperation)

Expand Down
Loading
Loading