Ignore:
Timestamp:
2010-07-29T09:55:12+02:00 (14 years ago)
Author:
stephankn
Message:

'version command evaluates permission flags'

Location:
applications/editors/josm/plugins/remotecontrol
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/remotecontrol/build.xml

    r22472 r22479  
    2828       
    2929        <!-- set before publising -->
    30         <property name="commit.message" value="Added version info capable of jsonp. Also made header CORS aware" />             
     30        <property name="commit.message" value="version command evaluates permission flags" />           
    3131        <property name="plugin.main.version" value="2830" />
    3232       
  • applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RemoteControlPreferences.java

    r19298 r22479  
    2929    private JCheckBox permissionChangeSelection = new JCheckBox(tr("change the selection"));
    3030    private JCheckBox permissionChangeViewport = new JCheckBox(tr("change the viewport"));
     31    private JCheckBox permissionReadProtocolversion = new JCheckBox(tr("read protocol version"));
    3132    private JCheckBox alwaysAskUserConfirm = new JCheckBox(tr("confirm all Remote Control actions manually"));
    3233
     
    4445        perms.add(permissionChangeSelection, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
    4546        perms.add(permissionChangeViewport, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
     47        perms.add(permissionReadProtocolversion, GBC.eol().insets(0,5,0,0).fill(GBC.HORIZONTAL));
    4648        remote.add(perms, GBC.eol().fill(GBC.HORIZONTAL));
    4749
     
    5456        permissionChangeViewport.setSelected(Main.pref.getBoolean("remotecontrol.permission.change-viewport", true));
    5557        permissionCreateObjects.setSelected(Main.pref.getBoolean("remotecontrol.permission.create-objects", true));
     58        permissionReadProtocolversion.setSelected(Main.pref.getBoolean("remotecontrol.permission.read-protocolversion", true));
    5659        alwaysAskUserConfirm.setSelected(Main.pref.getBoolean("remotecontrol.always-confirm", false));
    5760
     
    6366        Main.pref.put("remotecontrol.permission.change-viewport", permissionChangeViewport.isSelected());
    6467        Main.pref.put("remotecontrol.permission.create-objects", permissionCreateObjects.isSelected());
     68        Main.pref.put("remotecontrol.permission.read-protocolversion", permissionReadProtocolversion.isSelected());
    6569        Main.pref.put("remotecontrol.always-confirm", alwaysAskUserConfirm.isSelected());
    6670        // FIXME confirm return value - really no restart needed?
  • applications/editors/josm/plugins/remotecontrol/src/org/openstreetmap/josm/plugins/remotecontrol/RequestProcessor.java

    r22472 r22479  
    289289                // TODO: select/zoom to downloaded
    290290            } else if (command.equals("/version")) {
     291                if (!Main.pref.getBoolean("remotecontrol.permission.read-protocolversion", true)) {
     292                    sendForbidden(out);
     293                    System.out.println("RemoteControl: /version forbidden by preferences");
     294                    return;
     295                }
     296                if (Main.pref.getBoolean("remotecontrol.always-confirm", false)) {
     297                    if (JOptionPane.showConfirmDialog(Main.parent,
     298                        "<html>" + tr("Remote Control has been asked to report its protocol version. This enables web sites to detect a running JOSM.") +
     299                        "<br>" + tr("Do you want to allow this?"),
     300                        tr("Confirm Remote Control action"),
     301                        JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) {
     302                            sendForbidden(out);
     303                            return;
     304                    }
     305                }
     306
    291307                                content = RequestProcessor.PROTOCOLVERSION;
    292308                                contentType = "application/json";
Note: See TracChangeset for help on using the changeset viewer.