Author: ilgrosso
Date: Tue May 28 07:53:43 2013
New Revision: 1486803

URL: http://svn.apache.org/r1486803
Log:
[SYNCOPE-373] Merge from 1_1_X

Added:
    
syncope/trunk/console/src/main/resources/org/apache/syncope/console/markup/html/CrontabContainer_pt_BR.properties
      - copied unchanged from r1486800, 
syncope/branches/1_1_X/console/src/main/resources/org/apache/syncope/console/markup/html/CrontabContainer_pt_BR.properties
Modified:
    syncope/trunk/   (props changed)
    syncope/trunk/build-tools/pom.xml
    
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BulkActionResultModalPage.java
    
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
    
syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java
    
syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeUserDetailsService.java
    syncope/trunk/core/src/main/resources/restContext.xml
    syncope/trunk/core/src/main/resources/securityContext.xml
    syncope/trunk/core/src/main/resources/syncopeContext.xml
    syncope/trunk/core/src/main/resources/workflowContext.xml
    
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
    
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java

Propchange: syncope/trunk/
------------------------------------------------------------------------------
  Merged /syncope/branches/1_1_X:r1485966-1486800

Modified: syncope/trunk/build-tools/pom.xml
URL: 
http://svn.apache.org/viewvc/syncope/trunk/build-tools/pom.xml?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- syncope/trunk/build-tools/pom.xml (original)
+++ syncope/trunk/build-tools/pom.xml Tue May 28 07:53:43 2013
@@ -156,7 +156,7 @@ under the License.
           </configuration>
           <deployables>
             <deployable>
-              
<location>${basedir}/target/syncope-build-tools-${project.version}.war</location>
+              
<location>${project.build.directory}/syncope-build-tools-${project.version}.war</location>
               <properties>
                 <context>syncope-build-tools</context>
               </properties>

Modified: 
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BulkActionResultModalPage.java
URL: 
http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BulkActionResultModalPage.java?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- 
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BulkActionResultModalPage.java
 (original)
+++ 
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BulkActionResultModalPage.java
 Tue May 28 07:53:43 2013
@@ -56,6 +56,7 @@ public class BulkActionResultModalPage<T
         newColumnList.add(newColumnList.size(), new ActionResultColumn<T, 
S>(results, idFieldName));
 
         final SortableDataProvider<T, S> dataProvider = new 
SortableDataProvider<T, S>() {
+
             private static final long serialVersionUID = 5291903859908641954L;
 
             @Override
@@ -80,7 +81,7 @@ public class BulkActionResultModalPage<T
                 dataProvider,
                 Integer.MAX_VALUE).setVisible(items != null && 
!items.isEmpty()));
 
-        final AjaxLink close = new IndicatingAjaxLink("close") {
+        final AjaxLink<Void> close = new IndicatingAjaxLink<Void>("close") {
 
             private static final long serialVersionUID = -7978723352517770644L;
 

Modified: 
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- 
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
 (original)
+++ 
syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
 Tue May 28 07:53:43 2013
@@ -21,6 +21,7 @@ package org.apache.syncope.core.rest.dat
 import java.util.Date;
 import java.util.HashSet;
 import java.util.Set;
+import javax.annotation.Resource;
 import org.apache.commons.lang.StringUtils;
 import org.apache.syncope.common.mod.MembershipMod;
 import org.apache.syncope.common.mod.UserMod;
@@ -71,6 +72,9 @@ public class UserDataBinder extends Abst
     @Autowired
     private ConnObjectUtil connObjectUtil;
 
+    @Resource(name = "adminUser")
+    private String adminUser;
+
     @Transactional(readOnly = true)
     public SyncopeUser getUserFromId(final Long userId) {
         if (userId == null) {
@@ -96,8 +100,19 @@ public class UserDataBinder extends Abst
 
     @Transactional(readOnly = true)
     public UserTO getAuthenticatedUserTO() {
-        SyncopeUser authUser = 
userDAO.find(SecurityContextHolder.getContext().getAuthentication().getName());
-        return getUserTO(authUser);
+        final UserTO authUserTO;
+
+        final String authUsername = 
SecurityContextHolder.getContext().getAuthentication().getName();
+        if (adminUser.equals(authUsername)) {
+            authUserTO = new UserTO();
+            authUserTO.setId(-1);
+            authUserTO.setUsername(adminUser);
+        } else {
+            SyncopeUser authUser = userDAO.find(authUsername);
+            authUserTO = getUserTO(authUser);
+        }
+
+        return authUserTO;
     }
 
     @Transactional(readOnly = true)

Modified: 
syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- 
syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java
 (original)
+++ 
syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeAuthenticationProvider.java
 Tue May 28 07:53:43 2013
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.security;
 
 import java.util.Date;
+import javax.annotation.Resource;
 import org.apache.syncope.common.types.AuditElements.AuthenticationSubCategory;
 import org.apache.syncope.common.types.AuditElements.Category;
 import org.apache.syncope.common.types.AuditElements.Result;
@@ -53,36 +54,14 @@ public class SyncopeAuthenticationProvid
     @Autowired
     private UserDAO userDAO;
 
-    private SyncopeUserDetailsService userDetailsService;
-
+    @Resource(name = "adminUser")
     private String adminUser;
 
     private String adminPassword;
 
     private String adminPasswordAlgorithm;
 
-    public SyncopeUserDetailsService getSyncopeUserDetailsService() {
-        return userDetailsService;
-    }
-
-    public void setSyncopeUserDetailsService(final SyncopeUserDetailsService 
syncopeUserDetailsService) {
-        this.userDetailsService = syncopeUserDetailsService;
-    }
-
-    public String getAdminUser() {
-        return adminUser;
-    }
-
-    public void setAdminUser(final String adminUser) {
-        this.adminUser = adminUser;
-    }
-
-    /**
-     * @return the adminPassword
-     */
-    public String getAdminPassword() {
-        return adminPassword;
-    }
+    private SyncopeUserDetailsService userDetailsService;
 
     /**
      * @param adminPassword the adminPassword to set
@@ -92,19 +71,16 @@ public class SyncopeAuthenticationProvid
     }
 
     /**
-     * @return the adminPasswordAlgorithm
-     */
-    public String getAdminPasswordAlgorithm() {
-        return adminPasswordAlgorithm;
-    }
-
-    /**
      * @param adminPasswordAlgorithm the adminPasswordAlgorithm to set
      */
     public void setAdminPasswordAlgorithm(final String adminPasswordAlgorithm) 
{
         this.adminPasswordAlgorithm = adminPasswordAlgorithm;
     }
 
+    public void setSyncopeUserDetailsService(final SyncopeUserDetailsService 
syncopeUserDetailsService) {
+        this.userDetailsService = syncopeUserDetailsService;
+    }
+
     @Override
     @Transactional(noRollbackFor = {BadCredentialsException.class, 
DisabledException.class})
     public Authentication authenticate(final Authentication authentication)

Modified: 
syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeUserDetailsService.java
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeUserDetailsService.java?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- 
syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeUserDetailsService.java
 (original)
+++ 
syncope/trunk/core/src/main/java/org/apache/syncope/core/security/SyncopeUserDetailsService.java
 Tue May 28 07:53:43 2013
@@ -21,6 +21,7 @@ package org.apache.syncope.core.security
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import javax.annotation.Resource;
 import org.apache.syncope.core.persistence.beans.Entitlement;
 import org.apache.syncope.core.persistence.beans.role.SyncopeRole;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
@@ -49,16 +50,9 @@ public class SyncopeUserDetailsService i
     @Autowired
     private EntitlementDAO entitlementDAO;
 
+    @Resource(name = "adminUser")
     private String adminUser;
 
-    public String getAdminUser() {
-        return adminUser;
-    }
-
-    public void setAdminUser(String adminUser) {
-        this.adminUser = adminUser;
-    }
-
     @Override
     public UserDetails loadUserByUsername(final String username) throws 
UsernameNotFoundException, DataAccessException {
         final Set<SimpleGrantedAuthority> authorities = new 
HashSet<SimpleGrantedAuthority>();

Modified: syncope/trunk/core/src/main/resources/restContext.xml
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/restContext.xml?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/restContext.xml (original)
+++ syncope/trunk/core/src/main/resources/restContext.xml Tue May 28 07:53:43 
2013
@@ -36,10 +36,6 @@ under the License.
 
   <context:component-scan 
base-package="org.apache.syncope.core.rest.controller"/>
 
-  <bean id="adminUser" class="java.lang.String">
-    <constructor-arg value="${adminUser}"/>
-  </bean>
-  
   <!-- CXF Configuration - BEGIN -->
   <context:component-scan base-package="org.apache.syncope.core.services"/>
 

Modified: syncope/trunk/core/src/main/resources/securityContext.xml
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/securityContext.xml?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/securityContext.xml (original)
+++ syncope/trunk/core/src/main/resources/securityContext.xml Tue May 28 
07:53:43 2013
@@ -46,13 +46,10 @@ under the License.
   </security:http>
 
   <bean id="syncopeUserDetailsService"
-        class="org.apache.syncope.core.security.SyncopeUserDetailsService">
-    <property name="adminUser" value="${adminUser}"/>
-  </bean>
+        class="org.apache.syncope.core.security.SyncopeUserDetailsService"/>
 
   <bean id="syncopeAuthenticationProvider"
         class="org.apache.syncope.core.security.SyncopeAuthenticationProvider">
-    <property name="adminUser" value="${adminUser}"/>
     <property name="adminPassword" value="${adminPassword}"/>
     <property name="adminPasswordAlgorithm" value="${adminPasswordAlgorithm}"/>
     <property name="syncopeUserDetailsService" 
ref="syncopeUserDetailsService"/>

Modified: syncope/trunk/core/src/main/resources/syncopeContext.xml
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/syncopeContext.xml?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/syncopeContext.xml (original)
+++ syncope/trunk/core/src/main/resources/syncopeContext.xml Tue May 28 
07:53:43 2013
@@ -40,6 +40,10 @@ under the License.
     <property name="ignoreUnresolvablePlaceholders" value="true"/>
   </bean>
 
+  <bean id="adminUser" class="java.lang.String">
+    <constructor-arg value="${adminUser}"/>
+  </bean>
+
   <bean class="org.apache.syncope.core.util.ApplicationContextProvider"/>
 
   <context:component-scan base-package="org.apache.syncope.core.init"/>

Modified: syncope/trunk/core/src/main/resources/workflowContext.xml
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/workflowContext.xml?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/workflowContext.xml (original)
+++ syncope/trunk/core/src/main/resources/workflowContext.xml Tue May 28 
07:53:43 2013
@@ -22,10 +22,6 @@ under the License.
        xsi:schemaLocation="http://www.springframework.org/schema/beans   
                            
http://www.springframework.org/schema/beans/spring-beans.xsd";>
 
-  <bean id="adminUser" class="java.lang.String">
-    <constructor-arg value="${adminUser}"/>
-  </bean>
-
   <bean id="uwfAdapter" class="${uwfAdapter}"/>
   <bean id="rwfAdapter" class="${rwfAdapter}"/>
 

Modified: 
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- 
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java 
(original)
+++ 
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/AbstractTest.java 
Tue May 28 07:53:43 2013
@@ -107,7 +107,7 @@ public abstract class AbstractTest {
 
     protected static final String BASE_URL = 
"http://localhost:9080/syncope/rest/";;
 
-    protected static final String ADMIN_UID = "admin";
+    protected static final String ADMIN_UNAME = "admin";
 
     protected static final String ADMIN_PWD = "password";
 
@@ -199,7 +199,7 @@ public abstract class AbstractTest {
     }
 
     protected void resetRestTemplate() {
-        setupRestTemplate(ADMIN_UID, ADMIN_PWD);
+        setupRestTemplate(ADMIN_UNAME, ADMIN_PWD);
         userService = new UserServiceProxy(BASE_URL, restTemplate);
         userWorkflowService = new UserWorkflowServiceProxy(BASE_URL, 
restTemplate);
         roleService = new RoleServiceProxy(BASE_URL, restTemplate);
@@ -238,7 +238,7 @@ public abstract class AbstractTest {
     }
 
     protected <T> T createServiceInstance(final Class<T> serviceClass) {
-        return createServiceInstance(serviceClass, ADMIN_UID);
+        return createServiceInstance(serviceClass, ADMIN_UNAME);
     }
 
     protected <T> T createServiceInstance(final Class<T> serviceClass, final 
String username) {

Modified: 
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: 
http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1486803&r1=1486802&r2=1486803&view=diff
==============================================================================
--- 
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
 (original)
+++ 
syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
 Tue May 28 07:53:43 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.rest;
 
+import static org.apache.syncope.core.rest.AbstractTest.ADMIN_PWD;
 import static org.apache.syncope.core.rest.AbstractTest.getUUIDString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -2218,6 +2219,12 @@ public class UserTestITCase extends Abst
             
assertNotNull(scce.getException(SyncopeClientExceptionType.NotFound));
         }
     }
+    
+        @Test
+    public void issueSYNCOPE373() {
+        UserTO userTO = userService.readSelf();
+        assertEquals(ADMIN_UNAME, userTO.getUsername());
+    }
 
     private boolean getBooleanAttribute(ConnObjectTO connObjectTO, String 
attrName) {
         return Boolean.parseBoolean(getStringAttribute(connObjectTO, 
attrName));


Reply via email to