use of hudson.util.VersionNumber in project hudson-2.x by hudson.
the class OldDataMonitor method doUpgrade.
/**
* Save all or some of the files to persist data in the new forms.
* Remove those items from the data map.
*/
public synchronized HttpResponse doUpgrade(StaplerRequest req, StaplerResponse rsp) throws IOException {
String thruVerParam = req.getParameter("thruVer");
VersionNumber thruVer = thruVerParam.equals("all") ? null : new VersionNumber(thruVerParam);
updating = true;
for (Iterator<Map.Entry<Saveable, VersionRange>> it = data.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<Saveable, VersionRange> entry = it.next();
VersionNumber version = entry.getValue().max;
if (version != null && (thruVer == null || !version.isNewerThan(thruVer))) {
entry.getKey().save();
it.remove();
}
}
updating = false;
return HttpResponses.forwardToPreviousPage();
}
use of hudson.util.VersionNumber in project hudson-2.x by hudson.
the class GlobalMatrixAuthorizationStrategy method migrateHudson2324.
/**
* Due to HUDSON-2324, we want to inject Item.READ permission to everyone who has Hudson.READ,
* to remain backward compatible.
* @param grantedPermissions
*/
/*package*/
static boolean migrateHudson2324(Map<Permission, Set<String>> grantedPermissions) {
boolean result = false;
if (Hudson.getInstance().isUpgradedFromBefore(new VersionNumber("1.300.*"))) {
Set<String> f = grantedPermissions.get(Hudson.READ);
if (f != null) {
Set<String> t = grantedPermissions.get(Item.READ);
if (t != null)
result = t.addAll(f);
else {
t = new HashSet<String>(f);
result = true;
}
grantedPermissions.put(Item.READ, t);
}
}
return result;
}
Aggregations