mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-02 19:39:56 -05:00
rm privs check in dolt_purge_dropped_databases as it is already handled
This commit is contained in:
@@ -27,11 +27,6 @@ func doltPurgeDroppedDatabases(ctx *sql.Context, args ...string) (sql.RowIter, e
|
||||
return nil, fmt.Errorf("dolt_purge_dropped_databases does not take any arguments")
|
||||
}
|
||||
|
||||
// Only allow admins to purge dropped databases
|
||||
if err := checkDoltPurgeDroppedDatabasesPrivs(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
doltSession := dsess.DSessFromSess(ctx.Session)
|
||||
err := doltSession.Provider().PurgeDroppedDatabases(ctx)
|
||||
if err != nil {
|
||||
@@ -40,18 +35,3 @@ func doltPurgeDroppedDatabases(ctx *sql.Context, args ...string) (sql.RowIter, e
|
||||
|
||||
return rowToIter(int64(cmdSuccess)), nil
|
||||
}
|
||||
|
||||
// checkDoltPurgeDroppedDatabasesPrivs returns an error if the user requesting to purge dropped databases
|
||||
// does not have SUPER access. Since this is a permanent and destructive operation, we restrict it to admins,
|
||||
// even though the SUPER privilege has been deprecated, since there isn't another appropriate global privilege.
|
||||
func checkDoltPurgeDroppedDatabasesPrivs(ctx *sql.Context) error {
|
||||
privs, counter := ctx.GetPrivilegeSet()
|
||||
if counter == 0 {
|
||||
return fmt.Errorf("unable to check user privileges for dolt_purge_dropped_databases procedure")
|
||||
}
|
||||
if privs.Has(sql.PrivilegeType_Super) == false {
|
||||
return sql.ErrPrivilegeCheckFailed.New(ctx.Session.Client().User)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user