-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upstream: b=main,r=f3e06206cf50cddf6e30d3fb8e5a43c0936e8dfa,t=2024-03…
…-29-1243-27192
- Loading branch information
1 parent
5fa7bb2
commit 8abed4b
Showing
81 changed files
with
1,093 additions
and
433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...c/main/java/org/sonatype/nexus/internal/security/upgrade/SecurityDatabaseUpgrade_1_4.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Sonatype Nexus (TM) Open Source Version | ||
* Copyright (c) 2008-present Sonatype, Inc. | ||
* All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. | ||
* | ||
* This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, | ||
* which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. | ||
* | ||
* Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks | ||
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the | ||
* Eclipse Foundation. All other trademarks are the property of their respective owners. | ||
*/ | ||
package org.sonatype.nexus.internal.security.upgrade; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Named; | ||
import javax.inject.Provider; | ||
import javax.inject.Singleton; | ||
|
||
import org.sonatype.nexus.common.upgrade.Upgrades; | ||
import org.sonatype.nexus.orient.DatabaseInstance; | ||
import org.sonatype.nexus.orient.DatabaseInstanceNames; | ||
import org.sonatype.nexus.orient.DatabaseUpgradeSupport; | ||
import org.sonatype.nexus.orient.OClassNameBuilder; | ||
|
||
import com.orientechnologies.orient.core.sql.OCommandSQL; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
/** | ||
* Upgrade step to delete saml_users with empty id | ||
* | ||
*/ | ||
@Named | ||
@Singleton | ||
@Upgrades(model = DatabaseInstanceNames.SECURITY, from = "1.3", to = "1.4") | ||
public class SecurityDatabaseUpgrade_1_4 // NOSONAR | ||
extends DatabaseUpgradeSupport | ||
{ | ||
static final String DB_CLASS = new OClassNameBuilder().type("saml_user").build(); | ||
|
||
private static final String QUERY = String | ||
.format("DELETE FROM %s WHERE id = ''", DB_CLASS); | ||
|
||
private final Provider<DatabaseInstance> securityDatabaseInstance; | ||
|
||
@Inject | ||
public SecurityDatabaseUpgrade_1_4(@Named(DatabaseInstanceNames.SECURITY) final Provider<DatabaseInstance> securityDatabaseInstance) { | ||
this.securityDatabaseInstance = checkNotNull(securityDatabaseInstance); | ||
} | ||
|
||
@Override | ||
public void apply() { | ||
withDatabaseAndClass(securityDatabaseInstance, DB_CLASS, (db, type) -> { | ||
int updates = db.command(new OCommandSQL(QUERY)).execute(); | ||
if (updates > 0) { | ||
log.debug("Deleted {} saml users with empty id.", updates); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...onents/nexus-common/src/main/java/org/sonatype/nexus/common/analytics/RequestsMetric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Sonatype Nexus (TM) Open Source Version | ||
* Copyright (c) 2008-present Sonatype, Inc. | ||
* All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions. | ||
* | ||
* This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0, | ||
* which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html. | ||
* | ||
* Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks | ||
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the | ||
* Eclipse Foundation. All other trademarks are the property of their respective owners. | ||
*/ | ||
package org.sonatype.nexus.common.analytics; | ||
|
||
public interface RequestsMetric | ||
{ | ||
long get(); | ||
|
||
void reset(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.