1 23 24 25 package org.infoglue.cms.controllers.kernel.impl.simple; 26 27 import java.util.ArrayList ; 28 import java.util.Collections ; 29 import java.util.List ; 30 31 import org.exolab.castor.jdo.Database; 32 import org.infoglue.cms.entities.kernel.BaseEntityVO; 33 import org.infoglue.cms.entities.management.GroupVO; 34 import org.infoglue.cms.exception.ConstraintException; 35 import org.infoglue.cms.exception.SystemException; 36 import org.infoglue.cms.security.AuthorizationModule; 37 import org.infoglue.cms.security.InfoGlueAuthenticationFilter; 38 import org.infoglue.cms.security.InfoGlueGroup; 39 import org.infoglue.cms.util.sorters.ReflectionComparator; 40 41 46 47 public class GroupControllerProxy extends BaseController 48 { 49 private AuthorizationModule authorizationModule = null; 50 private Database transactionObject = null; 51 52 public GroupControllerProxy(Database transactionObject) 53 { 54 this.transactionObject = transactionObject; 55 } 56 57 public static GroupControllerProxy getController() 58 { 59 return new GroupControllerProxy(null); 60 } 61 62 public static GroupControllerProxy getController(Database transactionObject) 63 { 64 return new GroupControllerProxy(transactionObject); 65 } 66 67 70 71 private AuthorizationModule getAuthorizationModule() 72 { 73 try 76 { 77 authorizationModule = (AuthorizationModule)Class.forName(InfoGlueAuthenticationFilter.authorizerClass).newInstance(); 78 authorizationModule.setExtraProperties(InfoGlueAuthenticationFilter.extraProperties); 79 authorizationModule.setTransactionObject(this.transactionObject); 80 } 81 catch(Exception e) 82 { 83 e.printStackTrace(); 84 } 85 87 return authorizationModule; 88 } 89 90 93 94 public boolean getSupportUpdate() throws ConstraintException, SystemException, Exception 95 { 96 return getAuthorizationModule().getSupportUpdate(); 97 } 98 99 102 103 public boolean getSupportDelete() throws ConstraintException, SystemException, Exception 104 { 105 return getAuthorizationModule().getSupportDelete(); 106 } 107 108 111 112 public boolean getSupportCreate() throws ConstraintException, SystemException, Exception 113 { 114 return getAuthorizationModule().getSupportCreate(); 115 } 116 117 120 121 public List getAllGroups() throws ConstraintException, SystemException, Exception 122 { 123 List groups = new ArrayList (); 124 125 groups = getAuthorizationModule().getGroups(); 126 Collections.sort(groups, new ReflectionComparator("name")); 127 128 return groups; 129 } 130 131 134 135 public InfoGlueGroup getGroup(String groupName) throws ConstraintException, SystemException, Exception 136 { 137 InfoGlueGroup infoGlueGroup = null; 138 139 infoGlueGroup = getAuthorizationModule().getAuthorizedInfoGlueGroup(groupName); 140 141 return infoGlueGroup; 142 } 143 144 147 148 public List getInfoGluePrincipals(String groupName) throws ConstraintException, SystemException, Exception 149 { 150 List infoGluePrincipals = new ArrayList (); 151 152 infoGluePrincipals = getAuthorizationModule().getGroupUsers(groupName); 153 Collections.sort(infoGluePrincipals, new ReflectionComparator("name")); 154 155 return infoGluePrincipals; 156 } 157 158 159 162 163 public InfoGlueGroup createGroup(GroupVO groupVO) throws ConstraintException, SystemException, Exception 164 { 165 InfoGlueGroup infoGlueGroup = null; 166 167 getAuthorizationModule().createInfoGlueGroup(groupVO); 168 169 return getGroup(groupVO.getGroupName()); 170 } 171 172 175 176 public void updateGroup(GroupVO groupVO, String [] userNames) throws ConstraintException, SystemException, Exception 177 { 178 getAuthorizationModule().updateInfoGlueGroup(groupVO, userNames); 179 } 180 181 184 185 public void deleteGroup(String groupName) throws ConstraintException, SystemException, Exception 186 { 187 getAuthorizationModule().deleteInfoGlueGroup(groupName); 188 AccessRightController.getController().delete(groupName); 189 } 190 191 public BaseEntityVO getNewVO() 192 { 193 return null; 194 } 195 196 } 197 | Popular Tags |