1 24 package org.riotfamily.riot.security; 25 26 import java.util.ArrayList ; 27 import java.util.Collections ; 28 29 import org.riotfamily.riot.security.policy.AuthorizationPolicy; 30 import org.springframework.beans.factory.BeanFactoryUtils; 31 import org.springframework.context.ApplicationContext; 32 import org.springframework.context.ApplicationContextAware; 33 import org.springframework.core.OrderComparator; 34 35 41 public class AccessControlInitializer implements ApplicationContextAware { 42 43 public void setApplicationContext(ApplicationContext context) { 44 ArrayList policies = new ArrayList (); 45 policies.addAll(BeanFactoryUtils.beansOfTypeIncludingAncestors( 46 context, AuthorizationPolicy.class).values()); 47 48 Collections.sort(policies, new OrderComparator()); 49 AccessController.setPolicies(policies); 50 } 51 52 } 53 | Popular Tags |