Search in sources :

Example 1 with DBPDataSourcePermission

use of org.jkiss.dbeaver.model.DBPDataSourcePermission in project dbeaver by serge-rider.

the class DataSourceSerializerModern method serializeModifyPermissions.

private void serializeModifyPermissions(@NotNull JsonWriter json, DBPDataSourcePermissionOwner permissionOwner) throws IOException {
    List<DBPDataSourcePermission> permissions = permissionOwner.getModifyPermission();
    if (!CommonUtils.isEmpty(permissions)) {
        json.name("security");
        json.beginObject();
        List<String> permIds = new ArrayList<>(permissions.size());
        for (DBPDataSourcePermission perm : permissions) permIds.add(perm.getId());
        JSONUtils.serializeStringList(json, "permission-restrictions", permIds);
        json.endObject();
    }
}
Also used : DBPDataSourcePermission(org.jkiss.dbeaver.model.DBPDataSourcePermission)

Example 2 with DBPDataSourcePermission

use of org.jkiss.dbeaver.model.DBPDataSourcePermission in project dbeaver by serge-rider.

the class EditConnectionPermissionsDialog method okPressed.

@Override
protected void okPressed() {
    List<DBPDataSourcePermission> restrictions = new ArrayList<>();
    for (Button permButton : restrictedPermissionButtons) {
        if (permButton.getSelection()) {
            restrictions.add((DBPDataSourcePermission) permButton.getData());
        }
    }
    accessRestrictions = restrictions;
    super.okPressed();
}
Also used : Button(org.eclipse.swt.widgets.Button) DBPDataSourcePermission(org.jkiss.dbeaver.model.DBPDataSourcePermission) ArrayList(java.util.ArrayList)

Example 3 with DBPDataSourcePermission

use of org.jkiss.dbeaver.model.DBPDataSourcePermission in project dbeaver by dbeaver.

the class EditConnectionPermissionsDialog method okPressed.

@Override
protected void okPressed() {
    List<DBPDataSourcePermission> restrictions = new ArrayList<>();
    for (Button permButton : restrictedPermissionButtons) {
        if (permButton.getSelection()) {
            restrictions.add((DBPDataSourcePermission) permButton.getData());
        }
    }
    accessRestrictions = restrictions;
    super.okPressed();
}
Also used : Button(org.eclipse.swt.widgets.Button) DBPDataSourcePermission(org.jkiss.dbeaver.model.DBPDataSourcePermission) ArrayList(java.util.ArrayList)

Example 4 with DBPDataSourcePermission

use of org.jkiss.dbeaver.model.DBPDataSourcePermission in project dbeaver by dbeaver.

the class EditConnectionPermissionsDialog method createDialogArea.

@Override
protected Composite createDialogArea(Composite parent) {
    Composite composite = super.createDialogArea(parent);
    for (DBPDataSourcePermission permission : DBPDataSourcePermission.values()) {
        Button permButton = UIUtils.createCheckbox(composite, permission.getLabel(), permission.getDescription(), accessRestrictions.contains(permission), 1);
        permButton.setData(permission);
        permButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        restrictedPermissionButtons.add(permButton);
    }
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) DBPDataSourcePermission(org.jkiss.dbeaver.model.DBPDataSourcePermission) GridData(org.eclipse.swt.layout.GridData)

Example 5 with DBPDataSourcePermission

use of org.jkiss.dbeaver.model.DBPDataSourcePermission in project dbeaver by serge-rider.

the class EditConnectionPermissionsDialog method createDialogArea.

@Override
protected Composite createDialogArea(Composite parent) {
    Composite composite = super.createDialogArea(parent);
    for (DBPDataSourcePermission permission : DBPDataSourcePermission.values()) {
        Button permButton = UIUtils.createCheckbox(composite, permission.getLabel(), permission.getDescription(), accessRestrictions.contains(permission), 1);
        permButton.setData(permission);
        permButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        restrictedPermissionButtons.add(permButton);
    }
    return composite;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) DBPDataSourcePermission(org.jkiss.dbeaver.model.DBPDataSourcePermission) GridData(org.eclipse.swt.layout.GridData)

Aggregations

DBPDataSourcePermission (org.jkiss.dbeaver.model.DBPDataSourcePermission)8 Button (org.eclipse.swt.widgets.Button)4 ArrayList (java.util.ArrayList)2 GridData (org.eclipse.swt.layout.GridData)2 Composite (org.eclipse.swt.widgets.Composite)2 XMLBuilder (org.jkiss.utils.xml.XMLBuilder)2 XMLException (org.jkiss.utils.xml.XMLException)2