diff --git a/.gitignore b/.gitignore index 494f328308..ab4913a644 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,12 @@ dist/ /idea/ .idea/ +## Mac OS +.DS_Store + +## tests +server/test/io.cloudbeaver.test.platform/workspace/.data/ + ## Eclipse configs .project @@ -38,4 +44,4 @@ dist/ .settings/ deploy/cloudbeaver -server/**/target +server/**/target \ No newline at end of file diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/session/WebUserContext.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/session/WebUserContext.java index b635530768..2142fba75c 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/session/WebUserContext.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/session/WebUserContext.java @@ -17,6 +17,7 @@ package io.cloudbeaver.model.session; +import io.cloudbeaver.DBWConstants; import io.cloudbeaver.model.app.WebApplication; import io.cloudbeaver.model.user.WebUser; import org.jkiss.code.NotNull; @@ -149,6 +150,12 @@ public class WebUserContext implements SMCredentialsProvider { } else { this.userPermissions = getDefaultPermissions(); } + if (userPermissions != null && + !userPermissions.isEmpty() && + !userPermissions.contains(DBWConstants.PERMISSION_PUBLIC)) + { + userPermissions.add(DBWConstants.PERMISSION_PUBLIC); + } } public synchronized String getSmSessionId() { diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java index 0b4afcad39..319547bd7a 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBApplication.java @@ -795,6 +795,9 @@ public class CBApplication extends BaseWebApplication implements WebAuthApplicat } protected void saveRuntimeConfig(String newServerName, String newServerURL, long sessionExpireTime, CBAppConfig appConfig) throws DBException { + if (newServerName == null) { + throw new DBException("Invalid server configuration, server name cannot be empty"); + } Map configurationProperties = collectConfigurationProperties(newServerName, newServerURL, sessionExpireTime, appConfig); writeRuntimeConfig(configurationProperties); } diff --git a/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/RMConstants.java b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/RMConstants.java new file mode 100644 index 0000000000..36f7c36189 --- /dev/null +++ b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/RMConstants.java @@ -0,0 +1,31 @@ +/* + * DBeaver - Universal Database Manager + * Copyright (C) 2010-2022 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.service.rm; + +/** + * RM constants + */ +public interface RMConstants { + + String PERMISSION_PROJECT_VIEW = "project-view"; + String PERMISSION_PROJECT_EDIT = "project-edit"; + String PERMISSION_PROJECT_ADMIN = "project-admin"; + + // RM admin can create/delete projects. It also can assign project permissions. + String PERMISSION_RM_ADMIN = "rm-admin"; + +}