mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-1478 User parameters API
This commit is contained in:
@@ -98,6 +98,9 @@ type UserInfo {
|
||||
|
||||
# User profile properties map
|
||||
metaParameters: Object!
|
||||
|
||||
# USer configuiraiton parameters
|
||||
configurationParameters: Object!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
@@ -121,3 +124,10 @@ extend type Query {
|
||||
listUserProfileProperties: [ObjectPropertyInfo!]!
|
||||
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
|
||||
# Set user config parameter. If parameter value is null then removes the parameter
|
||||
setUserConfigurationParameter(name: String!, value: Object): Boolean!
|
||||
|
||||
}
|
||||
|
||||
+7
@@ -59,4 +59,11 @@ public interface DBWServiceAuth extends DBWService {
|
||||
|
||||
@WebAction()
|
||||
WebPropertyInfo[] listUserProfileProperties(@NotNull WebSession webSession);
|
||||
|
||||
@WebAction()
|
||||
boolean setUserConfigurationParameter(
|
||||
@NotNull WebSession webSession,
|
||||
@NotNull String name,
|
||||
@Nullable String value) throws DBWebException;
|
||||
|
||||
}
|
||||
|
||||
+10
-1
@@ -69,7 +69,7 @@ public class WebUserInfo {
|
||||
linkedProviders = CBApplication.getInstance().getSecurityController()
|
||||
.getUserLinkedProviders(session.getUser().getUserId());
|
||||
} catch (DBCException e) {
|
||||
throw new DBWebException("Error reading user linked providers");
|
||||
throw new DBWebException("Error reading user linked providers", e);
|
||||
}
|
||||
}
|
||||
return Arrays.asList(linkedProviders);
|
||||
@@ -80,4 +80,13 @@ public class WebUserInfo {
|
||||
return user.getMetaParameters();
|
||||
}
|
||||
|
||||
@Property
|
||||
public Map<String, Object> getConfigurationParameters() throws DBWebException {
|
||||
try {
|
||||
return CBApplication.getInstance().getSecurityController().getUserParameters(user.getUserId());
|
||||
} catch (DBCException e) {
|
||||
throw new DBWebException("Error reading user parameters", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+13
@@ -318,4 +318,17 @@ public class WebServiceAuthImpl implements DBWServiceAuth {
|
||||
.toArray(WebPropertyInfo[]::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setUserConfigurationParameter(@NotNull WebSession webSession, @NotNull String name, @Nullable String value) throws DBWebException {
|
||||
try {
|
||||
CBApplication.getInstance().getSecurityController().setUserParameter(
|
||||
webSession.getUser().getUserId(),
|
||||
name,
|
||||
value);
|
||||
return true;
|
||||
} catch (DBCException e) {
|
||||
throw new DBWebException("Error setting user parameter", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user