- Timestamp:
- 08/14/08 12:01:54 (3 years ago)
- Location:
- trunk/src/org/rapla
- Files:
-
- 6 modified
-
facade/QueryModule.java (modified) (1 diff)
-
facade/internal/FacadeImpl.java (modified) (2 diffs)
-
gui/internal/action/AppointmentAction.java (modified) (2 diffs)
-
gui/internal/action/ReservationAction.java (modified) (3 diffs)
-
gui/internal/common/CalendarModelImpl.java (modified) (4 diffs)
-
plugin/abstractcalendar/RaplaBuilder.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/rapla/facade/QueryModule.java
r1110 r1330 118 118 * The User cannot change appointments.*/ 119 119 boolean canExchangeAllocatables(Reservation reservation); 120 121 boolean canReadReservationsFromOthers(User user); 120 122 } 121 123 -
trunk/src/org/rapla/facade/internal/FacadeImpl.java
r1268 r1330 481 481 } 482 482 removeFilteredClassifications( reservations, filters); 483 484 //Category can_see = getUserGroupsCategory().getCategory( Permission.GROUP_CAN_READ_EVENTS_FROM_OTHERS); 483 485 Iterator it = reservations.iterator(); 486 boolean canSeeOthers = canReadReservationsFromOthers(user); 484 487 while ( it.hasNext() ) { 485 488 Reservation r = (Reservation) it.next(); 486 if ( workingUser == null || r.getOwner().equals( workingUser ) || workingUser.isAdmin())489 if ( workingUser == null || r.getOwner().equals( workingUser ) || canSeeOthers) 487 490 continue; 488 491 Allocatable[] allocatables = r.getAllocatables(); … … 691 694 return false; 692 695 } 696 } 697 698 public boolean canReadReservationsFromOthers(User user) 699 { 700 if ( user == null) 701 { 702 return workingUser == null || workingUser.isAdmin(); 703 } 704 if ( user.isAdmin()) 705 { 706 return true; 707 } 708 try { 709 Category can_see = getUserGroupsCategory().getCategory( Permission.GROUP_CAN_READ_EVENTS_FROM_OTHERS); 710 return user.belongsTo( can_see); 711 } 712 catch (Exception ex) 713 { 714 getLogger().error("Can't get permissions!", ex); 715 } 716 return false; 693 717 } 694 718 -
trunk/src/org/rapla/gui/internal/action/AppointmentAction.java
r1234 r1330 17 17 import java.util.Date; 18 18 19 import org.rapla.entities.User; 19 20 import org.rapla.entities.domain.Allocatable; 20 21 import org.rapla.entities.domain.Appointment; … … 156 157 putValue(NAME, getString("view")); 157 158 putValue(SMALL_ICON, getIcon("icon.help")); 159 User owner = appointment.getReservation().getOwner(); 160 try 161 { 162 User user = getUser(); 163 boolean canView = getQuery().canReadReservationsFromOthers( user) || user.equals( owner); 164 setEnabled( canView); 165 } 166 catch (RaplaException ex) 167 { 168 getLogger().error( "Can't get user",ex); 169 } 158 170 return this; 159 171 } -
trunk/src/org/rapla/gui/internal/action/ReservationAction.java
r1091 r1330 16 16 import java.awt.Point; 17 17 18 import org.rapla.entities.User; 18 19 import org.rapla.entities.domain.Reservation; 19 20 import org.rapla.entities.dynamictype.DynamicType; … … 82 83 setEnabled( m_wizard != null); 83 84 } 85 84 86 } 85 87 … … 87 89 m_wizard.start(parent, (CalendarModel)getService( CalendarModel.ROLE), guessType()); 88 90 } 91 92 89 93 } -
trunk/src/org/rapla/gui/internal/common/CalendarModelImpl.java
r1262 r1330 29 29 import org.rapla.components.util.DateTools; 30 30 import org.rapla.components.xmlbundle.I18nBundle; 31 import org.rapla.entities.Category; 31 32 import org.rapla.entities.Named; 32 33 import org.rapla.entities.RaplaObject; … … 37 38 import org.rapla.entities.domain.Appointment; 38 39 import org.rapla.entities.domain.AppointmentBlockArray; 40 import org.rapla.entities.domain.Permission; 39 41 import org.rapla.entities.domain.Reservation; 40 42 import org.rapla.entities.dynamictype.Classifiable; … … 517 519 518 520 public User[] getSelectedUsers() { 521 User currentUser = getUser(); 522 if ( currentUser != null && !m_facade.canReadReservationsFromOthers( currentUser)) 523 { 524 return new User[] {currentUser}; 525 } 519 526 return (User[]) getSelected(User.TYPE).toArray(User.USER_ARRAY); 520 527 } … … 612 619 User[] users = getSelectedUsers(); 613 620 User currentUser = getUser(); 621 622 623 614 624 return ( users.length == 1 && users[0].equals( currentUser)); 615 625 } -
trunk/src/org/rapla/plugin/abstractcalendar/RaplaBuilder.java
r1112 r1330 49 49 import org.rapla.entities.domain.Appointment; 50 50 import org.rapla.entities.domain.AppointmentBlockArray; 51 import org.rapla.entities.domain.Permission;52 51 import org.rapla.entities.domain.Reservation; 53 52 import org.rapla.entities.dynamictype.Attribute; … … 484 483 User user; 485 484 List blocks; 486 Category canReadOthersGroup;485 boolean canReadOthers; 487 486 488 487 public BuildContext(RaplaBuilder builder, List blocks) … … 499 498 this.logger = builder.getLogger(); 500 499 this.user = builder.editingUser; 501 try { 502 this.canReadOthersGroup = builder.getClientFacade().getUserGroupsCategory().getCategory( Permission.GROUP_CAN_READ_EVENTS_FROM_OTHERS); 503 } catch (RaplaException ex) 504 { 505 // we assume that there is no other group 506 } 500 this.canReadOthers = builder.getClientFacade().canReadReservationsFromOthers(user); 507 501 } 508 502 … … 643 637 return false; 644 638 } 645 if ( buildContext.canReadOthers Group == null || user.belongsTo( buildContext.canReadOthersGroup))639 if ( buildContext.canReadOthers ) 646 640 { 647 641 return false;
![(please configure the [header_logo] section in trac.ini)](/chrome/site/rapla.jpg)