Changeset 3644


Ignore:
Timestamp:
Aug 8, 2007, 2:45:36 PM (14 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #716: Plugin configuration import should be able ot set the permission on the imported configurations to the same as the plug-in itself

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/core/net/sf/basedb/plugins/PluginConfigurationImporter.java

    r3617 r3644  
    112112      "The XML-file to import the configuration parameters from",
    113113      new FileParameterType(null, true, 1));
    114  
     114  private static final PluginParameter<Boolean> setPermissionsParameter =
     115    new PluginParameter<Boolean>(
     116      "setPermissions",
     117      "Inherit shared permissions",
     118      "Select if the new configurations should be shared to the same users, " +
     119      "groups and projects as the plug-in they belong to. If FALSE, the new configurations " +
     120      "will not be shared.",
     121      new BooleanParameterType(true, true)
     122    );
    115123 
    116124  private RequestInformation configureJob;
     
    118126  // Variables to store the job parameters in.
    119127  private File xmlFile;
     128  private boolean setPermissions;
    120129
    121130  /*
     
    167176      }
    168177      storeValue(job, request, xmlFileParameter);
     178      storeValue(job, request, setPermissionsParameter);
    169179      response.setDone("The job configuration is complete");     
    170180    }   
     
    204214      {
    205215        xmlFile = (File)job.getValue("xmlfile");
     216        setPermissions = Boolean.TRUE.equals(job.getValue("setPermissions"));
    206217        is = xmlFile.getDownloadStream(0);       
    207218        boolean importable = isImportable(is);   
     
    308319        String pluginClassName = configuration.getAttributeValue("pluginClassName");
    309320       
    310      
    311321        PluginDefinition pluginDefinition = PluginDefinition.getByClassName(dc, pluginClassName);
    312        
    313         PluginConfiguration pluginConfig = PluginConfiguration.getNew(dc, pluginDefinition);         
    314         dc.saveItem(pluginConfig);
     322        PluginConfiguration pluginConfig = PluginConfiguration.getNew(dc, pluginDefinition);
     323        if (setPermissions)
     324        {
     325          pluginConfig.setItemKey(pluginDefinition.getItemKey());
     326          pluginConfig.setProjectKey(pluginDefinition.getProjectKey());
     327        }
    315328        pluginConfig.setName(name);
    316329        pluginConfig.setDescription(description);
     330        dc.saveItem(pluginConfig);
    317331       
    318332        List parameters = configuration.getChildren("parameter");
     
    345359           
    346360      parameters.add(xmlFileParameter);
     361      parameters.add(setPermissionsParameter);
    347362     
    348363      configureJob = new RequestInformation
Note: See TracChangeset for help on using the changeset viewer.