[#6931] Added a support for REVOKE GRANT OPTION FOR .. clause
[#6931] fix
This commit is contained in:
parent
343b645bd6
commit
eaea2b64ae
@ -9596,6 +9596,24 @@ public interface DSLContext extends Scope , AutoCloseable {
|
||||
@Support({ H2, POSTGRES })
|
||||
RevokeOnStep revoke(Collection<? extends Privilege> privileges);
|
||||
|
||||
/**
|
||||
* Revoke grant option for a privilege on a table from user or role
|
||||
*/
|
||||
@Support
|
||||
RevokeOnStep revokeGrantOptionFor(Privilege privilege);
|
||||
|
||||
/**
|
||||
* Revoke grant option for a privilege on a table from user or role
|
||||
*/
|
||||
@Support
|
||||
RevokeOnStep revokeGrantOptionFor(Privilege... privilege);
|
||||
|
||||
/**
|
||||
* Revoke grant option for a privilege on a table from user or role
|
||||
*/
|
||||
@Support
|
||||
RevokeOnStep revokeGrantOptionFor(Collection<? extends Privilege> privileges);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX Other queries for identites and sequences
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -3477,6 +3477,21 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
|
||||
return new RevokeImpl(configuration(), privileges);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RevokeOnStep revokeGrantOptionFor(Privilege privilege) {
|
||||
return revokeGrantOptionFor(Arrays.asList(privilege));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RevokeOnStep revokeGrantOptionFor(Privilege... privileges) {
|
||||
return revokeGrantOptionFor(Arrays.asList(privileges));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RevokeOnStep revokeGrantOptionFor(Collection<? extends Privilege> privileges) {
|
||||
return new RevokeImpl(configuration(), privileges, true);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// XXX Other queries for identites and sequences
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
@ -137,6 +137,7 @@ final class Keywords {
|
||||
static final Keyword K_GENERATED_BY_DEFAULT_AS_IDENTITY = keyword("generated by default as identity");
|
||||
static final Keyword K_GLOBAL_TEMPORARY = keyword("global temporary");
|
||||
static final Keyword K_GRANT = keyword("grant");
|
||||
static final Keyword K_GRANT_OPTION_FOR = keyword("grant option for");
|
||||
static final Keyword K_GROUP_BY = keyword("group by");
|
||||
static final Keyword K_HAVING = keyword("having");
|
||||
static final Keyword K_HOUR_TO_SECOND = keyword("hour to second");
|
||||
|
||||
@ -43,6 +43,7 @@ import static org.jooq.Clause.REVOKE_ON;
|
||||
import static org.jooq.Clause.REVOKE_PRIVILEGE;
|
||||
import static org.jooq.impl.DSL.table;
|
||||
import static org.jooq.impl.Keywords.K_FROM;
|
||||
import static org.jooq.impl.Keywords.K_GRANT_OPTION_FOR;
|
||||
import static org.jooq.impl.Keywords.K_ON;
|
||||
import static org.jooq.impl.Keywords.K_PUBLIC;
|
||||
import static org.jooq.impl.Keywords.K_REVOKE;
|
||||
@ -82,11 +83,16 @@ final class RevokeImpl extends AbstractQuery implements
|
||||
private Role role;
|
||||
private Table<?> table;
|
||||
private User user;
|
||||
private final boolean grantOptionFor;
|
||||
|
||||
RevokeImpl(Configuration configuration, Collection<? extends Privilege> privileges, boolean grantOptionFor) {
|
||||
super(configuration);
|
||||
this.privileges = privileges;
|
||||
this.grantOptionFor = grantOptionFor;
|
||||
}
|
||||
|
||||
RevokeImpl(Configuration configuration, Collection<? extends Privilege> privileges) {
|
||||
super(configuration);
|
||||
|
||||
this.privileges = privileges;
|
||||
this(configuration, privileges, false);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@ -98,6 +104,10 @@ final class RevokeImpl extends AbstractQuery implements
|
||||
ctx.start(REVOKE_PRIVILEGE)
|
||||
.visit(K_REVOKE).sql(' ');
|
||||
|
||||
if (grantOptionFor)
|
||||
ctx.visit(K_GRANT_OPTION_FOR)
|
||||
.sql(' ');
|
||||
|
||||
String separator = "";
|
||||
for (Privilege privilege : privileges) {
|
||||
ctx.sql(separator)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user