13
13
import org .jumpserver .chen .framework .i18n .MessageUtils ;
14
14
import org .jumpserver .chen .framework .jms .entity .CommandRecord ;
15
15
import org .jumpserver .chen .framework .session .SessionManager ;
16
+ import org .jumpserver .chen .framework .session .controller .dialog .Button ;
17
+ import org .jumpserver .chen .framework .session .controller .dialog .Dialog ;
16
18
import org .jumpserver .chen .framework .utils .TreeUtils ;
17
19
import org .jumpserver .chen .framework .ws .io .Packet ;
18
- import org .jumpserver .chen . wisp .Common ;
20
+ import org .jumpserver .wisp .Common ;
19
21
import org .springframework .web .socket .WebSocketSession ;
20
22
21
23
import java .sql .SQLException ;
22
24
import java .util .Map ;
25
+ import java .util .concurrent .CountDownLatch ;
26
+ import java .util .concurrent .atomic .AtomicBoolean ;
23
27
24
28
public class DataViewConsole extends AbstractConsole {
25
29
@@ -110,6 +114,7 @@ public void createDataView(String schemaName, String tableName) {
110
114
.getSqlActuator ()
111
115
.createPlan (schemaName , tableName , null );
112
116
var sql = plan .getTargetSQL ();
117
+
113
118
var aclResult = session .checkACL (sql );
114
119
if (aclResult != null && (aclResult .getRiskLevel () == Common .RiskLevel .Reject || aclResult .getRiskLevel () == Common .RiskLevel .ReviewReject )) {
115
120
this .getConsoleLogger ().error ("%s" , MessageUtils .get ("ACLRejectError" ));
@@ -121,6 +126,42 @@ public void createDataView(String schemaName, String tableName) {
121
126
this .stateManager .commit ();
122
127
throw new SQLException (MessageUtils .get ("ACLRejectError" ));
123
128
}
129
+
130
+ if (aclResult !=null && aclResult .isNotify ()) {
131
+
132
+ var dialog = new Dialog (MessageUtils .get ("Warning" ));
133
+ dialog .setBody (MessageUtils .get ("CommandWarningDialogMessage" ));
134
+ var countDownLatch = new CountDownLatch (1 );
135
+ AtomicBoolean hasNext = new AtomicBoolean (true );
136
+
137
+ dialog .addButton (new Button (MessageUtils .get ("Submit" ), "submit" , countDownLatch ::countDown ));
138
+
139
+ dialog .addButton (new Button (MessageUtils .get ("Cancel" ), "cancel" , () -> {
140
+ hasNext .set (false );
141
+ countDownLatch .countDown ();
142
+ this .getConsoleLogger ().warn (MessageUtils .get ("ExecutionCanceled" ));
143
+ }));
144
+
145
+ SessionManager .getCurrentSession ().getController ().showDialog (dialog );
146
+
147
+ try {
148
+ countDownLatch .await ();
149
+
150
+ if (!hasNext .get ()) {
151
+ throw new SQLException (MessageUtils .get ("ExecutionCanceled" ));
152
+ }
153
+
154
+ } catch (InterruptedException e ) {
155
+ this .stateManager .commit ();
156
+
157
+ this .getConsoleLogger ().error ("get result error" );
158
+ } finally {
159
+ SessionManager .getCurrentSession ().getController ().closeDialog ();
160
+ }
161
+ }
162
+
163
+
164
+
124
165
plan .setSqlQueryParams (sqlQueryParams );
125
166
plan .generateTargetSQL ();
126
167
0 commit comments