Skip to content

Commit

Permalink
column privilege
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Mar 3, 2024
1 parent cd2dc36 commit 3f63285
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.apache.doris.nereids.privileges;

import org.apache.doris.analysis.ResourceTypeEnum;
import org.apache.doris.analysis.UserIdentity;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.Env;
Expand Down Expand Up @@ -299,12 +298,6 @@ public void checkColsPriv(UserIdentity currentUser, String ctl, String db, Strin
}
}
}

@Override
public boolean checkCloudPriv(UserIdentity currentUser, String resourceName, PrivPredicate wanted,
ResourceTypeEnum type) {
return true;
}
}

private static class MakePrivileges {
Expand Down Expand Up @@ -354,7 +347,7 @@ public TablePrivilege(String catalog, String db, String table, String user) {
}

public boolean checkTblPriv(UserIdentity currentUser, String ctl, String db, String tbl) {
return isSameTable(ctl, db, tbl) && StringUtils.equals(this.user, currentUser.getUser());
return isSameTable(ctl, db, tbl) && StringUtils.equals(this.user, currentUser.getQualifiedUser());
}

public boolean isSameTable(String catalog, String db, String tbl) {
Expand All @@ -380,12 +373,12 @@ public ColumnPrivilege(String catalog, String db, String table, String user, Set
}

public boolean checkTblPriv(UserIdentity currentUser, String ctl, String db, String tbl) {
return isSameTable(ctl, db, tbl) && StringUtils.equals(this.user, currentUser.getUser());
return isSameTable(ctl, db, tbl) && StringUtils.equals(this.user, currentUser.getQualifiedUser());
}

public boolean checkColsPriv(UserIdentity currentUser, String ctl, String db, String tbl, String col) {
return isSameTable(ctl, db, tbl)
&& StringUtils.equals(this.user, currentUser.getUser()) && allowColumns.contains(col);
&& StringUtils.equals(this.user, currentUser.getQualifiedUser()) && allowColumns.contains(col);
}

public boolean isSameTable(String catalog, String db, String tbl) {
Expand Down

0 comments on commit 3f63285

Please sign in to comment.