Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CB-4513. Added event for execute task success #2575

Merged
merged 5 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/bundles/io.cloudbeaver.server/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
<eventHandler class="io.cloudbeaver.server.events.WSUserDeletedEventHandler">
<topic id="cb_user"/>
</eventHandler>
<eventHandler class="io.cloudbeaver.server.events.WSTaskExecuteHandler">
<topic id="cb_task"/>
</eventHandler>
</extension>

</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.cloudbeaver.server.events;

import io.cloudbeaver.WebProjectImpl;
import io.cloudbeaver.model.session.BaseWebSession;
import io.cloudbeaver.model.session.WebSession;
import io.cloudbeaver.service.security.SMUtils;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.rm.RMProjectPermission;
import org.jkiss.dbeaver.model.websocket.event.WSTaskExecuteEvent;

public class WSTaskExecuteHandler extends WSDefaultEventHandler<WSTaskExecuteEvent> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to EE repo


protected void updateSessionData(@NotNull BaseWebSession activeUserSession, @NotNull WSTaskExecuteEvent event) {
super.updateSessionData(activeUserSession, event);
}

protected boolean isAcceptableInSession(@NotNull BaseWebSession activeUserSession, @NotNull WSTaskExecuteEvent event) {
return activeUserSession.isProjectAccessible(event.getProjectName())
&& SMUtils.hasProjectPermission(
(WebSession) activeUserSession,
((WebProjectImpl) event.getProject()).getRmProject(),
RMProjectPermission.RESOURCE_EDIT);
}
}
Loading