1 package org.enhydra.shark.usergroup; 2 3 import org.enhydra.shark.api.*; 4 5 import org.enhydra.shark.api.internal.usergroup.*; 6 import org.enhydra.shark.api.internal.working.CallbackUtilities; 7 8 import java.util.*; 9 10 16 public class LDAPUserGroupManager implements UserGroupManager { 17 18 private LDAPClient ldapClient; 20 21 private CallbackUtilities cus; 22 23 32 public void configure (CallbackUtilities cus) throws RootException { 33 this.cus=cus; 34 ldapClient=new LDAPClient(cus); 35 } 36 37 45 public List getAllGroupnames (UserTransaction t) throws RootException { 46 try { 47 return ldapClient.getAllOrganizationalUnitEntries(); 48 } catch (Throwable ex) { 49 throw new RootException(ex); 50 } 51 } 52 53 61 public List getAllUsers (UserTransaction t) throws RootException { 62 try{ 63 return ldapClient.getAllUserEntries(); 64 } catch (Throwable ex) { 65 throw new RootException(ex); 66 } 67 } 68 69 78 public List getAllUsers (UserTransaction t,String groupName) throws RootException { 79 try { 80 return ldapClient.getAllUserEntries(groupName); 81 } catch (Throwable ex) { 82 throw new RootException(ex); 83 } 84 } 85 86 95 public List getAllUsers (UserTransaction t,List groupNames) throws RootException { 96 try{ 97 Iterator it=groupNames.iterator(); 98 List ret=new ArrayList(); 99 while (it.hasNext()){ 100 String groupName=(String )it.next(); 101 ret.addAll(ldapClient.getAllUserEntries(groupName)); 102 } 103 return ret; 104 } catch (Throwable ex) { 105 throw new RootException(ex); 106 } 107 } 108 118 public List getAllImmediateUsers (UserTransaction t,String groupName) throws RootException { 119 try { 120 return ldapClient.getAllImmediateUserEntries(groupName); 121 } catch (Throwable ex) { 122 throw new RootException(ex); 123 } 124 } 125 126 135 public List getAllSubgroups (UserTransaction t, String groupName) throws RootException { 136 try { 137 return ldapClient.getAllSubOrganizationalUnitEntries(groupName); 138 } catch (Throwable ex) { 139 throw new RootException(ex); 140 } 141 } 142 143 152 public List getAllSubgroups (UserTransaction t, List groupNames) throws RootException { 153 try{ 154 Iterator it=groupNames.iterator(); 155 List ret=new ArrayList(); 156 while (it.hasNext()){ 157 String groupName=(String )it.next(); 158 ret.addAll(ldapClient.getAllSubOrganizationalUnitEntries(groupName)); 159 } 160 return ret; 161 } catch (Throwable ex) { 162 throw new RootException(ex); 163 } 164 } 165 166 176 public List getAllImmediateSubgroups (UserTransaction t, String groupName) throws RootException { 177 try { 178 return ldapClient.getAllImmediateSubOrganizationalUnitEntries(groupName); 179 } catch (Throwable ex) { 180 throw new RootException(ex); 181 } 182 } 183 184 193 public void createGroup (UserTransaction t,String groupName,String description) throws RootException { 194 throw new RootException("Not implemented"); 195 } 196 197 205 public void removeGroup (UserTransaction t,String groupName) throws RootException { 206 throw new RootException("Not implemented"); 207 } 208 209 218 public boolean doesGroupExist (UserTransaction t,String groupName) throws RootException { 219 try { 220 return ldapClient.doesGroupExist(groupName); 221 } catch (Throwable ex) { 222 throw new RootException(ex); 223 } 224 } 225 226 237 public boolean doesGroupBelongToGroup (UserTransaction t,String groupName, String subgroupName) throws RootException { 238 try { 239 return ldapClient.doesGroupBelongToGroup(groupName,subgroupName); 240 } catch (Throwable ex) { 241 throw new RootException(ex); 242 } 243 } 244 245 254 public void updateGroup (UserTransaction t,String groupName,String description) throws RootException { 255 throw new RootException("Not implemented"); 256 } 257 258 267 public void addGroupToGroup (UserTransaction t,String groupName,String subgroupName) throws RootException { 268 throw new RootException("Not implemented"); 269 } 270 271 280 public void removeGroupFromGroup (UserTransaction t,String groupName,String subgroupName) throws RootException { 281 throw new RootException("Not implemented"); 282 } 283 284 293 public void removeGroupTree (UserTransaction t,String groupName) throws RootException { 294 throw new RootException("Not implemented"); 295 } 296 297 306 public void removeUsersFromGroupTree (UserTransaction t,String groupName) throws RootException { 307 throw new RootException("Not implemented"); 308 } 309 310 321 public void moveGroup (UserTransaction t,String currentParentGroup,String newParentGroup,String subgroupName) throws RootException{ 322 throw new RootException("Not implemented"); 323 } 324 325 334 public String getGroupDescription (UserTransaction t,String groupName) throws RootException { 335 try { 336 return ldapClient.getGroupAttribute(groupName,ldapClient.getLDAPOptions().getGroupDescriptionAttributeName()); 337 } catch (Throwable ex) { 338 throw new RootException(ex); 339 } 340 } 341 342 343 352 public void addUserToGroup (UserTransaction t,String groupName,String username) throws RootException { 353 throw new RootException("Not implemented"); 354 } 355 356 365 public void removeUserFromGroup (UserTransaction t,String groupName,String username) throws RootException { 366 throw new RootException("Not implemented"); 367 } 368 369 380 public void moveUser (UserTransaction t,String currentGroup,String newGroup,String username) throws RootException { 381 throw new RootException("Not implemented"); 382 } 383 384 395 public boolean doesUserBelongToGroup (UserTransaction t,String groupName,String username) throws RootException { 396 try { 397 return ldapClient.doesUserBelongToGroup(groupName,username); 398 } catch (Throwable ex) { 399 throw new RootException(ex); 400 } 401 } 402 403 422 public void createUser (UserTransaction t,String groupName,String username, String password, String firstName, String lastName, String emailAddress) throws RootException { 423 throw new RootException("Not implemented"); 424 } 425 426 439 public void updateUser (UserTransaction t, String username, String firstName, String lastName, String emailAddress) throws RootException { 440 throw new RootException("Not implemented"); 441 } 442 443 452 public void removeUser (UserTransaction t,String username) throws RootException { 453 throw new RootException("Not implemented"); 454 } 455 456 465 public boolean doesUserExist (UserTransaction t,String username) throws RootException { 466 try { 467 return ldapClient.doesUserExist(username); 468 } catch (Throwable ex) { 469 throw new RootException(ex); 470 } 471 } 472 473 482 public void setPassword (UserTransaction t,String username,String password) throws RootException { 483 throw new RootException("Not implemented"); 484 } 485 486 496 public String getUserRealName (UserTransaction t,String username) throws RootException { 497 try { 498 return ldapClient.getUserAttribute(username,ldapClient.getLDAPOptions().getUserRealNameAttributeName()); 499 } catch (Throwable ex) { 500 throw new RootException(ex); 501 } 502 } 503 504 513 public String getUserFirstName (UserTransaction t,String username) throws RootException { 514 try { 515 return ldapClient.getUserAttribute(username,ldapClient.getLDAPOptions().getUserFirstNameAttributeName()); 516 } catch (Throwable ex) { 517 throw new RootException(ex); 518 } 519 } 520 521 530 public String getUserLastName (UserTransaction t,String username) throws RootException { 531 try { 532 return ldapClient.getUserAttribute(username,ldapClient.getLDAPOptions().getUserLastNameAttributeName()); 533 } catch (Throwable ex) { 534 throw new RootException(ex); 535 } 536 } 537 538 547 public String getUserEMailAddress (UserTransaction t,String username) throws RootException { 548 try { 549 return ldapClient.getUserAttribute(username,ldapClient.getLDAPOptions().getUserEmailAttributeName()); 550 } catch (Throwable ex) { 551 throw new RootException(ex); 552 } 553 } 554 555 556 } 557 | Popular Tags |