Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
[maven-release-plugin] copy for tag nexus-1.2.0.3
Browse files Browse the repository at this point in the history
git-svn-id: file:///opt/svn/repositories/sonatype.org/nexus/tags/nexus-1.2.0.3@2915 2aa8b3fc-8ebb-4439-a84f-95066eaea8ab
  • Loading branch information
mpowers committed Jan 7, 2009
2 parents d548956 + c8134ad commit 33ce2b1
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 59 deletions.
Expand Up @@ -214,7 +214,8 @@
<privilege>39</privilege>
<privilege>40</privilege>
<privilege>41</privilege>
<privilege>72</privilege>
<privilege>72</privilege>
<privilege>75</privilege>
</privileges>
</role>
<role>
Expand Down Expand Up @@ -1490,6 +1491,22 @@
<value>nexus:componentsrepotypes</value>
</property>
</properties>
</privilege>
<privilege>
<id>75</id>
<type>method</type>
<name>User Locator Types Component - (read)</name>
<description>Give permission to retrieve the list of User Locator types supported by nexus.</description>
<properties>
<property>
<key>method</key>
<value>read</value>
</property>
<property>
<key>permission</key>
<value>nexus:componentsuserlocatortypes</value>
</property>
</properties>
</privilege>

</privileges>
Expand Down
@@ -0,0 +1,32 @@
package org.sonatype.nexus.rest.users;

import org.codehaus.plexus.component.annotations.Component;
import org.restlet.data.Request;
import org.sonatype.jsecurity.locators.users.PlexusUserLocator;
import org.sonatype.nexus.rest.component.AbstractComponentListPlexusResource;
import org.sonatype.plexus.rest.resource.PathProtectionDescriptor;
import org.sonatype.plexus.rest.resource.PlexusResource;

@Component( role = PlexusResource.class, hint = "UserLocatorComponentListPlexusResource" )
public class UserLocatorComponentListPlexusResource
extends AbstractComponentListPlexusResource
{

@Override
public String getResourceUri()
{
return "/components/userLocators";
}

public PathProtectionDescriptor getResourceProtection()
{
return new PathProtectionDescriptor( getResourceUri(), "authcBasic,perms[nexus:componentsuserlocatortypes]" );
}

@Override
protected String getRole( Request request )
{
return PlexusUserLocator.class.getName();
}

}
Expand Up @@ -112,14 +112,32 @@ protected boolean onAccessDenied( ServletRequest request, ServletResponse respon
{
Subject subject = getSubject( request, response );

getLogger().info(
"Unable to authorize user [" + subject.getPrincipal() + "] for " + getActionFromHttpVerb( request )
+ " to " + ( (HttpServletRequest) request ).getRequestURI() + " from address/host ["
+ request.getRemoteAddr() + "/" + request.getRemoteHost() + "]" );
if ( !isAnonymousUser( request, subject ) )
{
getLogger().debug(
"Unable to authorize user [" + subject.getPrincipal() + "] for " + getActionFromHttpVerb( request )
+ " to " + ( (HttpServletRequest) request ).getRequestURI() + " from address/host ["
+ request.getRemoteAddr() + "/" + request.getRemoteHost() + "]" );
}

request.setAttribute( NexusJSecurityFilter.REQUEST_IS_AUTHZ_REJECTED, Boolean.TRUE );

return false;
}

protected boolean isAnonymousUser( ServletRequest request, Subject subject )
{
if ( !getNexus( request ).isAnonymousAccessEnabled() )
{
return false;
}

if ( getNexus( request ).getAnonymousUsername().equals( subject.getPrincipal() ) )
{
return true;
}

return false;
}

}
2 changes: 2 additions & 0 deletions nexus-webapp/src/main/webapp/js/Sonatype.config.js
Expand Up @@ -100,6 +100,8 @@ Sonatype.config = function() {
trash: servicePath + '/wastebasket',
plexusUsersAllConfigured: servicePath + '/plexus_users/allConfigured',
plexusUsersDefault: servicePath + '/plexus_users/default',
plexusUsers: servicePath + '/plexus_users',
userLocators: servicePath + '/components/userLocators',
searchUsers: servicePath + '/user_search',
plexusUser: servicePath + '/plexus_user',
userToRoles: servicePath + '/user_to_roles',
Expand Down
135 changes: 97 additions & 38 deletions nexus-webapp/src/main/webapp/js/repoServer/repoServer.UserEditPanel.js
Expand Up @@ -44,10 +44,54 @@ Sonatype.repoServer.UserEditPanel = function( config ) {
}
};

this.displaySelector = new Ext.Button( {
text: 'All Configured Users',
icon: Sonatype.config.resourcePath + '/images/icons/page_white_stack.png',
cls: 'x-btn-text-icon',
value: 'allConfigured',
menu: {
id: 'user-realm-selector-menu',
items: [
{
text: 'All Users',
checked: false,
handler: this.showUsers,
value: 'all',
group: 'user-realm-selector',
scope: this
}
]
}
} );

this.sourceStore = new Ext.data.JsonStore( {
root: 'data',
id: 'roleHint',
autoLoad: true,
url: Sonatype.config.repos.urls.userLocators,
sortInfo: { field: 'description', direction: 'ASC' },
fields: [
{ name: 'roleHint' },
{ name: 'description', sortType:Ext.data.SortTypes.asUCString }
],
listeners: {
load: {
fn: this.loadSources,
scope: this
}
}
} );

this.searchField = new Ext.app.SearchField( {
searchPanel: this,
width: 240,
emptyText: 'Show All Users With Nexus Roles'
disabled: true,
width: 250,
emptyText: 'Select a filter to enable username search',

onTrigger2Click : function(){
var v = this.getRawValue();
this.searchPanel.startSearch( this.searchPanel );
}
} );

Sonatype.Events.on( 'userAddMenuInit', this.onAddMenuInit, this );
Expand Down Expand Up @@ -112,25 +156,7 @@ Sonatype.repoServer.UserEditPanel = function( config ) {
},
tbar: [
' ',
{
text: 'Find',
icon: Sonatype.config.resourcePath + '/images/icons/search.gif',
cls: 'x-btn-text-icon',
menu: {
items: [
{
text: 'Show Default Realm Users',
handler: this.showDefaultUsers,
scope: this
},
{
text: 'Show All Users With Nexus Roles',
handler: this.showMappedUsers,
scope: this
}
]
}
},
this.displaySelector,
this.searchField
]
} );
Expand Down Expand Up @@ -255,7 +281,7 @@ Ext.extend( Sonatype.repoServer.UserEditPanel, Sonatype.panels.GridViewer, {
refreshHandler: function( button, e ) {
this.clearCards();
if ( this.lastUrl ) {
this.searchByUrl( this.lastUrl );
this.searchByUrl();
}
else {
this.dataStore.reload();
Expand Down Expand Up @@ -299,12 +325,12 @@ Ext.extend( Sonatype.repoServer.UserEditPanel, Sonatype.panels.GridViewer, {
}
},

searchByUrl: function( url ) {
this.lastUrl = url;
searchByUrl: function() {
this.clearCards();
this.gridPanel.loadMask.show();
Ext.Ajax.request( {
scope: this,
url: url,
url: this.lastUrl,
callback: function( options, success, response ) {
this.gridPanel.loadMask.hide();
if ( success ) {
Expand All @@ -320,23 +346,39 @@ Ext.extend( Sonatype.repoServer.UserEditPanel, Sonatype.panels.GridViewer, {
} );
},

showDefaultUsers: function( button, e ) {
this.searchField.emptyText = button.text;
this.stopSearch( this );
this.searchByUrl( Sonatype.config.repos.urls.plexusUsersDefault );
},
showUsers: function( button, e ) {
this.displaySelector.setText( button.text );
this.displaySelector.value = button.value;

showMappedUsers: function( button, e ) {
this.searchField.emptyText = button.text;
this.stopSearch( this );
this.searchByUrl( Sonatype.config.repos.urls.plexusUsersAllConfigured );
if ( button.value == 'allConfigured' ) {
this.searchField.emptyText = 'Select a filter to enable username search';
this.searchField.setValue( '' );
this.searchField.disable();
this.calculateSearchUrl( this );
this.searchByUrl();
}
else {
this.searchField.emptyText = 'Enter a username or leave blank to display all';
this.searchField.setValue( '' );
this.searchField.enable();
this.calculateSearchUrl( this );
}
},

startSearch: function( panel ) {
this.searchField.emptyText = null;
panel.searchField.triggers[0].show();
panel.searchByUrl( Sonatype.config.repos.urls.searchUsers + '/all/' +
panel.searchField.getValue() );
panel.calculateSearchUrl( panel );
panel.searchByUrl();
},

calculateSearchUrl: function( panel ) {
var v = panel.searchField.getValue();
var prefix = '/' + panel.displaySelector.value;
if ( v.length > 0 ) {
panel.lastUrl = Sonatype.config.repos.urls.searchUsers + prefix + '/' + panel.searchField.getValue();
}
else {
panel.lastUrl = Sonatype.config.repos.urls.plexusUsers + prefix;
}
},

stopSearch: function( panel ) {
Expand Down Expand Up @@ -453,6 +495,23 @@ Ext.extend( Sonatype.repoServer.UserEditPanel, Sonatype.panels.GridViewer, {
} );
}
}
},

loadSources: function( store, records, options ) {
var menu = Ext.menu.MenuMgr.get( 'user-realm-selector-menu' );

for ( var i = 0; i < records.length; i++ ) {
var rec = records[i];
var v = rec.data.roleHint;
menu.addMenuItem( {
text: v == 'default' ? 'Default Realm Users' : rec.data.description,
value: v,
checked: v == 'allConfigured',
handler: this.showUsers,
group: 'user-realm-selector',
scope: this
} );
}
}
} );

Expand Down
31 changes: 15 additions & 16 deletions pom.xml
Expand Up @@ -112,6 +112,19 @@
</releases>
</pluginRepository>
</pluginRepositories>
<!-- Shortcuts for outnumbered deps :) -->
<properties>
<plexus.appbooter.version>1.6.4.1</plexus.appbooter.version>
<jsw.binaries.version>3.2.3.2</jsw.binaries.version>
<plexus-jsecurity-realms.version>1.0.5</plexus-jsecurity-realms.version>
<slf4j.version>1.5.5</slf4j.version>
<maven.version>2.1-SONATYPE-653485</maven.version>
<nexus.indexer.version>1.1.2.3</nexus.indexer.version>
<!-- Shared with nexus-client, hence it is properties'ed -->
<plexus.restlet.bridge.version>1.6.1</plexus.restlet.bridge.version>
<micromailer.version>1.0.2</micromailer.version>
<mercury.version>1.0.0-alpha-2-722647</mercury.version>
</properties>
<modules>
<module>nexus-utils</module>
<module>nexus-api</module>
Expand All @@ -128,29 +141,15 @@
<profile>
<id>test-harness</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>test-harness</name>
<name>!skip-test-harness</name>
</property>
</activation>
<modules>
<module>nexus-test-harness</module>
</modules>
</profile>
</profiles>
<!-- Shortcuts for outnumbered deps :) -->
<properties>
<plexus.appbooter.version>1.6.4</plexus.appbooter.version>
<jsw.binaries.version>3.2.3.2</jsw.binaries.version>
<plexus-jsecurity-realms.version>1.0.5</plexus-jsecurity-realms.version>
<slf4j.version>1.5.5</slf4j.version>
<maven.version>2.1-SONATYPE-653485</maven.version>
<nexus.indexer.version>1.1.2.3</nexus.indexer.version>
<!-- Shared with nexus-client, hence it is properties'ed -->
<plexus.restlet.bridge.version>1.6</plexus.restlet.bridge.version>
<micromailer.version>1.0.2</micromailer.version>
<mercury.version>1.0.0-alpha-2-722647</mercury.version>
</properties>
</profiles>
<dependencyManagement>
<dependencies>
<!-- Platform -->
Expand Down

0 comments on commit 33ce2b1

Please sign in to comment.