@@ -426,76 +426,6 @@ func (n *Revoke) HandleRoutinePrivileges(user *mysql_db.User, dbName string, rou
426426 return nil
427427}
428428
429- // RevokeAll represents the statement REVOKE ALL PRIVILEGES.
430- type RevokeAll struct {
431- Users []UserName
432- }
433-
434- var _ sql.Node = (* RevokeAll )(nil )
435- var _ sql.CollationCoercible = (* RevokeAll )(nil )
436- var _ sql.AuthorizationCheckerNode = (* RevokeAll )(nil )
437-
438- // NewRevokeAll returns a new RevokeAll node.
439- func NewRevokeAll (users []UserName ) * RevokeAll {
440- return & RevokeAll {
441- Users : users ,
442- }
443- }
444-
445- // Schema implements the interface sql.Node.
446- func (n * RevokeAll ) Schema () sql.Schema {
447- return types .OkResultSchema
448- }
449-
450- func (n * RevokeAll ) IsReadOnly () bool {
451- return false
452- }
453-
454- // String implements the interface sql.Node.
455- func (n * RevokeAll ) String () string {
456- users := make ([]string , len (n .Users ))
457- for i , user := range n .Users {
458- users [i ] = user .String ("" )
459- }
460- return fmt .Sprintf ("RevokeAll(From: %s)" , strings .Join (users , ", " ))
461- }
462-
463- // Resolved implements the interface sql.Node.
464- func (n * RevokeAll ) Resolved () bool {
465- return true
466- }
467-
468- // Children implements the interface sql.Node.
469- func (n * RevokeAll ) Children () []sql.Node {
470- return nil
471- }
472-
473- // WithChildren implements the interface sql.Node.
474- func (n * RevokeAll ) WithChildren (children ... sql.Node ) (sql.Node , error ) {
475- if len (children ) != 0 {
476- return nil , sql .ErrInvalidChildrenNumber .New (n , len (children ), 0 )
477- }
478- return n , nil
479- }
480-
481- // CheckAuth implements the interface sql.AuthorizationCheckerNode.
482- func (n * RevokeAll ) CheckAuth (ctx * sql.Context , opChecker sql.PrivilegedOperationChecker ) bool {
483- createUser := sql .NewPrivilegedOperation (sql.PrivilegeCheckSubject {}, sql .PrivilegeType_CreateUser )
484- superUser := sql .NewPrivilegedOperation (sql.PrivilegeCheckSubject {}, sql .PrivilegeType_Super )
485-
486- subject := sql.PrivilegeCheckSubject {Database : "mysql" }
487- mysqlUpdate := sql .NewPrivilegedOperation (subject , sql .PrivilegeType_Update )
488-
489- return opChecker .UserHasPrivileges (ctx , createUser ) ||
490- opChecker .UserHasPrivileges (ctx , superUser ) ||
491- opChecker .UserHasPrivileges (ctx , mysqlUpdate )
492- }
493-
494- // CollationCoercibility implements the interface sql.CollationCoercible.
495- func (* RevokeAll ) CollationCoercibility (ctx * sql.Context ) (collation sql.CollationID , coercibility byte ) {
496- return sql .Collation_binary , 7
497- }
498-
499429// RevokeRole represents the statement REVOKE [role...] FROM [user...].
500430type RevokeRole struct {
501431 Roles []UserName
0 commit comments