bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
public Event getCurrentEvent() { checkReady("getCurrentEvent"); return CurrentDetails.getCreationEvent(); }
|
public Event getCurrentEvent() { checkReady("getCurrentEvent"); return CurrentDetails.getCreationEvent(); }
| 3,228,453
|
public long getRootId() { return 0L; }
|
public long getRootId() { return 0L; }
| 3,228,454
|
public String getRootName() { return "root"; }
|
public String getRootName() { return "root"; }
| 3,228,455
|
public long getSystemGroupId() { return 0L; }
|
public long getSystemGroupId() { return 0L; }
| 3,228,456
|
public String getSystemGroupName( ) { return "system";}
|
public String getSystemGroupName( ) { return "system";}
| 3,228,457
|
public long getUserGroupId() { return 1L; }
|
public long getUserGroupId() { return 1L; }
| 3,228,458
|
public String getUserGroupName( ) { return "user"; }
|
public String getUserGroupName( ) { return "user"; }
| 3,228,459
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
| 3,228,460
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
| 3,228,461
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
| 3,228,462
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
| 3,228,463
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
| 3,228,464
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
| 3,228,465
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
|
private boolean hasPrivilegedToken( IObject obj ) { GraphHolder gh = obj.getGraphHolder(); // most objects will not have a token if ( gh.hasToken() ) { // check if truly secure. if (gh.tokenMatches(token)) return true; // oh well, now see if this object has a one-time token. Token t = oneTimeTokens.find(gh); if ( t != null ) { // it does have the token, so it is privileged for one action // set token to null for future checks. gh.setToken(t,null); oneTimeTokens.remove(t); return true; } } return false; }
| 3,228,466
|
protected boolean idEqual( IObject arg1, IObject arg2 ) { // arg1 is null if ( arg1 == null ) { // both are null, therefore equal if ( arg2 == null ) return true; // just arg1 is null, can't be equal return false; } // just arg2 is null, also can't be equal else if ( arg2 == null ) return false; // neither argument is null, // so let's move a level down. Long arg1_id = arg1.getId(); Long arg2_id = arg2.getId(); // arg1_id is null if ( arg1_id == null ) { // both are null, therefore equal if ( arg2_id == null ) return true; // just arg2_id is null, can't be equal return false; } // just arg2_id null, and also can't be equal else if ( arg2_id == null ) return false; // neither null, then we can just test the ids. else return arg1_id.equals( arg2_id ); }
|
protected boolean idEqual( IObject arg1, IObject arg2 ) { // arg1 is null if ( arg1 == null ) { // both are null, therefore equal if ( arg2 == null ) return true; // just arg1 is null, can't be equal return false; } // just arg2 is null, also can't be equal else if ( arg2 == null ) return false; // neither argument is null, // so let's move a level down. Long arg1_id = arg1.getId(); Long arg2_id = arg2.getId(); // arg1_id is null if ( arg1_id == null ) { // both are null, therefore equal if ( arg2_id == null ) return true; // just arg2_id is null, can't be equal return false; } // just arg2_id null, and also can't be equal else if ( arg2_id == null ) return false; // neither null, then we can just test the ids. else return arg1_id.equals( arg2_id ); }
| 3,228,467
|
public boolean isDisabled(String id) { if (id==null) throw new ApiUsageException("Id should not be null."); return CurrentDetails.isDisabled(id); }
|
public boolean isDisabled(String id) { if (id==null) throw new ApiUsageException("Id should not be null."); return CurrentDetails.isDisabled(id); }
| 3,228,468
|
public boolean isGlobal( Class<? extends IObject> klass) { if ( klass == null ) return false; if ( Experimenter.class.isAssignableFrom( klass )) return true; if ( Event.class.isAssignableFrom( klass )) return true; return false; }
|
public boolean isGlobal( Class<? extends IObject> klass) { if ( klass == null ) return false; if ( Experimenter.class.isAssignableFrom( klass )) return true; if ( Event.class.isAssignableFrom( klass )) return true; return false; }
| 3,228,469
|
public boolean isReady( ) { // TODO could check for open session. if ( CurrentDetails.getCreationEvent() != null && CurrentDetails.getGroup() != null && CurrentDetails.getOwner() != null ) { return true; } return false; }
|
public boolean isReady( ) { // TODO could check for open session. if ( CurrentDetails.getCreationEvent() != null && CurrentDetails.getGroup() != null && CurrentDetails.getOwner() != null ) { return true; } return false; }
| 3,228,470
|
public boolean isReady( ) { // TODO could check for open session. if ( CurrentDetails.getCreationEvent() != null && CurrentDetails.getGroup() != null && CurrentDetails.getOwner() != null ) { return true; } return false; }
|
public boolean isReady( ) { // TODO could check for open session. if ( CurrentDetails.getCreationEvent() != null && CurrentDetails.getGroup() != null && CurrentDetails.getOwner() != null ) { return true; } return false; }
| 3,228,471
|
public boolean isSystemGroup( ExperimenterGroup group ) { return group == null || group.getId() == null? false : group.getId().equals( getSystemGroupId() ); }
|
public boolean isSystemGroup( ExperimenterGroup group ) { return group == null || group.getId() == null? false : group.getId().equals( getSystemGroupId() ); }
| 3,228,472
|
public boolean isSystemType( Class<? extends IObject> klass ) { if ( klass == null ) return false; if ( Experimenter.class.isAssignableFrom( klass )) return true; if ( ExperimenterGroup.class.isAssignableFrom( klass )) return true; if ( GroupExperimenterMap.class.isAssignableFrom( klass )) return true; if ( Event.class.isAssignableFrom( klass )) return true; if ( EventLog.class.isAssignableFrom( klass )) return true; if ( EventDiff.class.isAssignableFrom( klass )) return true; if ( IEnum.class.isAssignableFrom( klass )) return true; return false; }
|
public boolean isSystemType( Class<? extends IObject> klass ) { if ( klass == null ) return false; if ( Experimenter.class.isAssignableFrom( klass )) return true; if ( ExperimenterGroup.class.isAssignableFrom( klass )) return true; if ( GroupExperimenterMap.class.isAssignableFrom( klass )) return true; if ( Event.class.isAssignableFrom( klass )) return true; if ( EventLog.class.isAssignableFrom( klass )) return true; if ( EventDiff.class.isAssignableFrom( klass )) return true; if ( IEnum.class.isAssignableFrom( klass )) return true; return false; }
| 3,228,473
|
public Collection<Long> leaderOfGroups() { checkReady("leaderOfGroups"); return CurrentDetails.getLeaderOfGroups(); }
|
public Collection<Long> leaderOfGroups() { checkReady("leaderOfGroups"); return CurrentDetails.getLeaderOfGroups(); }
| 3,228,474
|
public void lockMarked( ) { Set<IObject> c = CurrentDetails.getLockCandidates(); for (IObject i : c) { Details d = i.getDetails(); Permissions p = new Permissions( d.getPermissions() ); p.set( Flag.LOCKED ); d.setPermissions( p ); } }
|
public void lockMarked( ) { Set<IObject> c = CurrentDetails.getLockCandidates(); for (IObject i : c) { Details d = i.getDetails(); Permissions p = new Permissions( d.getPermissions() ); p.set( Flag.LOCKED ); d.setPermissions( p ); } }
| 3,228,475
|
public void lockMarked( ) { Set<IObject> c = CurrentDetails.getLockCandidates(); for (IObject i : c) { Details d = i.getDetails(); Permissions p = new Permissions( d.getPermissions() ); p.set( Flag.LOCKED ); d.setPermissions( p ); } }
|
public void lockMarked( ) { Set<IObject> c = CurrentDetails.getLockCandidates(); for (IObject i : c) { Details d = i.getDetails(); Permissions p = new Permissions( d.getPermissions() ); p.set( Flag.LOCKED ); d.setPermissions( p ); } }
| 3,228,476
|
public void lockMarked( ) { Set<IObject> c = CurrentDetails.getLockCandidates(); for (IObject i : c) { Details d = i.getDetails(); Permissions p = new Permissions( d.getPermissions() ); p.set( Flag.LOCKED ); d.setPermissions( p ); } }
|
public void lockMarked( ) { Set<IObject> c = CurrentDetails.getLockCandidates(); for (IObject i : c) { Details d = i.getDetails(); Permissions p = new Permissions( d.getPermissions() ); p.set( Flag.LOCKED ); d.setPermissions( p ); } }
| 3,228,477
|
public void lockMarked( ) { Set<IObject> c = CurrentDetails.getLockCandidates(); for (IObject i : c) { Details d = i.getDetails(); Permissions p = new Permissions( d.getPermissions() ); p.set( Flag.LOCKED ); d.setPermissions( p ); } }
|
public void lockMarked( ) { Set<IObject> c = CurrentDetails.getLockCandidates(); for (IObject i : c) { Details d = i.getDetails(); Permissions p = new Permissions( d.getPermissions() ); p.set( Flag.LOCKED ); d.setPermissions( p ); } }
| 3,228,478
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
| 3,228,479
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
| 3,228,480
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
| 3,228,481
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
| 3,228,482
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
|
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances."); // Note: privileged check moved into the if statement below. // check if the newDetails variable has been reset or if the instance // has been changed. boolean altered = false; final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); // This happens if all fields of details are null (which can't happen) // And is so uninteresting for all of our checks. The object can't be // locked and nothing can be edited. Just return null. if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } } // Also uninteresting. If the users say nothing, then the originals. // Probably common since users don't worry about this information. else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } // Now we have to make sure certain things do not happen. The following // take into account whether or not the entity is privileged (has a token), // is locked in the database, and who the current user and group are. } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; // isGlobal implies nothing (currently) about permissions // see mapping.vm for more. altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) // implies that owner doesn't matter { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that group doesn't matter { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) // implies that event doesn't matter { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 );// throw new ValidationException(// "Version must properly be set on managed objects :\n"+// obj.toString()// ); //TODO } return altered ? newDetails : previousDetails; }
| 3,228,483
|
protected boolean managedEvent( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { if ( ! idEqual( previousDetails.getCreationEvent(), currentDetails.getCreationEvent())) { // no one change them. throw new SecurityViolation(String.format( "You are not authorized to change " + "the creation event for %s from %s to %s", obj, previousDetails.getCreationEvent(), currentDetails.getCreationEvent() )); } // they are equal meaning no change was intended but in case other // changes took place, we have to make sure newDetails has the correct // value else { newDetails.setCreationEvent(previousDetails.getCreationEvent()); } return false; }
|
protected boolean managedEvent( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { if ( ! idEqual( previousDetails.getCreationEvent(), currentDetails.getCreationEvent())) { // no one change them. throw new SecurityViolation(String.format( "You are not authorized to change " + "the creation event for %s from %s to %s", obj, previousDetails.getCreationEvent(), currentDetails.getCreationEvent() )); } // they are equal meaning no change was intended but in case other // changes took place, we have to make sure newDetails has the correct // value else { newDetails.setCreationEvent(previousDetails.getCreationEvent()); } return false; }
| 3,228,484
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
| 3,228,485
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
| 3,228,486
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
| 3,228,487
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
| 3,228,488
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
| 3,228,489
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
| 3,228,490
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
|
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // previous and current have different ids. either change it and return // true if permitted, or throw an exception. if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) { if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); } // even root can't set them to null. else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; } // if user is a member of the group or the current user is an admin // or if the entity has been marked as privileged, then use the // current group. else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup()); return true; } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the group for %s from %s to %s", obj, previousDetails.getGroup(), currentDetails.getGroup() )); } } // previous and current are the same, but we need to set // that value on newDetails. else { // This doesn't need to return true, because it'll only // be used if something else was changed. newDetails.setGroup( previousDetails.getGroup()); } return false; }
| 3,228,491
|
protected boolean managedOwner( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { if (! idEqual( previousDetails.getOwner(), currentDetails.getOwner() )) { if ( locked ) { throw new SecurityViolation( "Cannot change owner for:" + obj ); } // if the current user is an admin or if the entity has been // marked privileged, then use the current owner. else if ( currentUserIsAdmin() || privileged ) { // even root can't set them to null. if ( currentDetails.getOwner() == null ) { newDetails.setOwner( previousDetails.getOwner() ); return true; } } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the owner for %s from %s to %s", obj, previousDetails.getOwner(), currentDetails.getOwner() )); } } else { // values are the same. ensure they are the same for // newDetails as well newDetails.setOwner(previousDetails.getOwner()); } return false; }
|
protected boolean managedOwner( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { if (! idEqual( previousDetails.getOwner(), currentDetails.getOwner() )) { if ( locked ) { throw new SecurityViolation( "Cannot change owner for:" + obj ); } // if the current user is an admin or if the entity has been // marked privileged, then use the current owner. else if ( currentUserIsAdmin() || privileged ) { // even root can't set them to null. if ( currentDetails.getOwner() == null ) { newDetails.setOwner( previousDetails.getOwner() ); return true; } } // everyone else can't change them at all. else { throw new SecurityViolation(String.format( "You are not authorized to change " + "the owner for %s from %s to %s", obj, previousDetails.getOwner(), currentDetails.getOwner() )); } } else { // values are the same. ensure they are the same for // newDetails as well newDetails.setOwner(previousDetails.getOwner()); } return false; }
| 3,228,492
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
| 3,228,493
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
| 3,228,494
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
| 3,228,495
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
| 3,228,496
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
| 3,228,497
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
|
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { // setup boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions(); // ignore newDetails permissions. // If the stored perms are null, then we can't validate anything if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; // don't need to update } else { newDetails.setPermissions( currentP ); altered = true; } } // WORKAROUND for ticket:307 by checking for SOFT below// see https://trac.openmicroscopy.org.uk/omero/ticket/307// see http://opensource.atlassian.com/projects/hibernate/browse/HHH-2027 // Users did not enter permission (normal case) so is null OR // in the workaround permissions is SOFT, then // need to copy whole sale those from database. else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; } // if the user has set the permissions (currentDetails), then we should // try to allow that. if it's identical to the current, then there // is no reason to hit the DB. else { // if we need to filter any permissions, do it here! newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } // now we've calculated the desired permissions, throw // a security violation if this instance was locked AND // the read permissions have been lowered or if the lock // was removed. if ( locked ) { if (previousP == null) // if null it can't have been locked. throw new InternalException("Null permissions cannot be locked"); Permissions newP = newDetails.getPermissions(); if ( newP != null ) { // can't override newP.set( Flag.LOCKED ); if ((previousP.isGranted(USER, READ) && !newP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !newP.isGranted( GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !newP.isGranted( WORLD, READ))) throw new SecurityViolation( "Cannot remove READ from locked entity:" + obj) ; } } // privileged plays no role since everyone can alter their permissions // (within bounds) return altered; }
| 3,228,498
|
public void markLockedIfNecessary( IObject iObject, Details trustedDetails ) { if ( iObject == null ) return; Set<IObject> s = new HashSet<IObject>(); if ( trustedDetails != null && trustedDetails.getPermissions().isSet( Flag.LOCKED ) ) s.add( iObject ); IObject[] candidates = em.getLockCandidates( iObject ); for (IObject object : candidates) { s.add(object); // TODO NEED TO CHECK FOR OWNERSHIP etc. etc. } CurrentDetails.appendLockCandidates( s ); }
|
public void markLockedIfNecessary( IObject iObject, Details trustedDetails ) { if ( iObject == null ) return; Set<IObject> s = new HashSet<IObject>(); if ( trustedDetails != null && trustedDetails.getPermissions().isSet( Flag.LOCKED ) ) s.add( iObject ); IObject[] candidates = em.getLockCandidates( iObject ); for (IObject object : candidates) { s.add(object); // TODO NEED TO CHECK FOR OWNERSHIP etc. etc. } CurrentDetails.appendLockCandidates( s ); }
| 3,228,499
|
public void markLockedIfNecessary( IObject iObject, Details trustedDetails ) { if ( iObject == null ) return; Set<IObject> s = new HashSet<IObject>(); if ( trustedDetails != null && trustedDetails.getPermissions().isSet( Flag.LOCKED ) ) s.add( iObject ); IObject[] candidates = em.getLockCandidates( iObject ); for (IObject object : candidates) { s.add(object); // TODO NEED TO CHECK FOR OWNERSHIP etc. etc. } CurrentDetails.appendLockCandidates( s ); }
|
public void markLockedIfNecessary( IObject iObject, Details trustedDetails ) { if ( iObject == null ) return; Set<IObject> s = new HashSet<IObject>(); if ( trustedDetails != null && trustedDetails.getPermissions().isSet( Flag.LOCKED ) ) s.add( iObject ); IObject[] candidates = em.getLockCandidates( iObject ); for (IObject object : candidates) { s.add(object); // TODO NEED TO CHECK FOR OWNERSHIP etc. etc. } CurrentDetails.appendLockCandidates( s ); }
| 3,228,500
|
public void markLockedIfNecessary( IObject iObject, Details trustedDetails ) { if ( iObject == null ) return; Set<IObject> s = new HashSet<IObject>(); if ( trustedDetails != null && trustedDetails.getPermissions().isSet( Flag.LOCKED ) ) s.add( iObject ); IObject[] candidates = em.getLockCandidates( iObject ); for (IObject object : candidates) { s.add(object); // TODO NEED TO CHECK FOR OWNERSHIP etc. etc. } CurrentDetails.appendLockCandidates( s ); }
|
public void markLockedIfNecessary( IObject iObject, Details trustedDetails ) { if ( iObject == null ) return; Set<IObject> s = new HashSet<IObject>(); if ( trustedDetails != null && trustedDetails.getPermissions().isSet( Flag.LOCKED ) ) s.add( iObject ); IObject[] candidates = em.getLockCandidates( iObject ); for (IObject object : candidates) { s.add(object); // TODO NEED TO CHECK FOR OWNERSHIP etc. etc. } CurrentDetails.appendLockCandidates( s ); }
| 3,228,501
|
public Collection<Long> memberOfGroups() { checkReady("memberOfGroups"); return CurrentDetails.getMemberOfGroups(); }
|
public Collection<Long> memberOfGroups() { checkReady("memberOfGroups"); return CurrentDetails.getMemberOfGroups(); }
| 3,228,502
|
public void newEvent( EventType type ) { CurrentDetails.newEvent( type, token ); }
|
public void newEvent( EventType type ) { CurrentDetails.newEvent( type, token ); }
| 3,228,503
|
public void runAsAdmin( AdminAction action ) { Assert.notNull(action); CurrentDetails.setAdmin(true); try { action.runAsAdmin(); } finally { CurrentDetails.setAdmin(false); } }
|
public void runAsAdmin( AdminAction action ) { Assert.notNull(action); CurrentDetails.setAdmin(true); try { action.runAsAdmin(); } finally { CurrentDetails.setAdmin(false); } }
| 3,228,504
|
public void runAsAdmin( AdminAction action ) { Assert.notNull(action); CurrentDetails.setAdmin(true); try { action.runAsAdmin(); } finally { CurrentDetails.setAdmin(false); } }
|
public void runAsAdmin( AdminAction action ) { Assert.notNull(action); CurrentDetails.setAdmin(true); try { action.runAsAdmin(); } finally { CurrentDetails.setAdmin(false); } }
| 3,228,505
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
| 3,228,506
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
| 3,228,507
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
| 3,228,508
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
| 3,228,509
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
| 3,228,510
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
| 3,228,511
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
| 3,228,512
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); } }
|
public void setCurrentDetails() { LocalAdmin localAdmin = (LocalAdmin) sf.getAdminService(); ITypes iTypes = sf.getTypesService(); IUpdate iUpdate = sf.getUpdateService(); clearCurrentDetails(); if ( ec == null ) throw new InternalException( "EventContext is null in EventContext. Invalid configuration." ); if ( ec.getPrincipal() == null ) throw new InternalException( "Principal is null in EventContext. Security system failure." ); if (ec.getPrincipal().getName() == null) throw new InternalException( "Principal.name is null in EventContext. Security system failure."); final Principal p = ec.getPrincipal(); // Experimenter final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); // Member of Groups List<Long> memberOfGroupsIds = exp.eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); // Leader of Groups List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); // Active group if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); // isAdmin if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); List<Long> memberOfGroupsIds = exp .eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class, p .getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type, token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.", ex); setCurrentEvent(event); } } // Event if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class,p.getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type,token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); List<Long> memberOfGroupsIds = exp .eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class, p .getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type, token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.", ex); setCurrentEvent(event); } } catch (InvalidDataAccessApiUsageException ex) { // TODO check for read-only bef. exception log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.",ex); setCurrentEvent( event ); final Experimenter exp = localAdmin.lookupExperimenter(p.getName()); exp.getGraphHolder().setToken(token, token); CurrentDetails.setOwner(exp); List<Long> memberOfGroupsIds = exp .eachLinkedExperimenterGroup(new IdBlock()); CurrentDetails.setMemberOfGroups(memberOfGroupsIds); List<Long> leaderOfGroupsIds = localAdmin.getLeaderOfGroupIds(exp); CurrentDetails.setLeaderOfGroups(leaderOfGroupsIds); if (p.getGroup() == null) throw new InternalException( "Principal.group is null in EventContext. Security system failure."); ExperimenterGroup grp = localAdmin.groupProxy(p.getGroup()); grp.getGraphHolder().setToken(token, token); CurrentDetails.setGroup(grp); if (isSystemGroup(grp)) { CurrentDetails.setAdmin(true); } if (p.getEventType() == null) throw new InternalException( "Principal.eventType is null in EventContext. Security system failure."); EventType type = iTypes.getEnumeration(EventType.class, p .getEventType()); type.getGraphHolder().setToken(token, token); CurrentDetails.newEvent(type, token); Event event = getCurrentEvent(); event.getGraphHolder().setToken(token, token); try { setCurrentEvent(iUpdate.saveAndReturnObject(event)); } catch (InvalidDataAccessApiUsageException ex) { log.warn("Attempt to save event in SecuritySystem failed. " + "Using unsaved.", ex); setCurrentEvent(event); } } }
| 3,228,513
|
public void setCurrentEvent( Event event ) { CurrentDetails.setCreationEvent( event ); }
|
public void setCurrentEvent( Event event ) { CurrentDetails.setCreationEvent( event ); }
| 3,228,514
|
public final void setExtendedMetadata( ExtendedMetadata metadata ) { if ( this.em != null ) throw new InternalException( "Cannot reset metadata." ); this.em = metadata; }
|
public final void setExtendedMetadata( ExtendedMetadata metadata ) { if ( this.em != null ) throw new InternalException( "Cannot reset metadata." ); this.em = metadata; }
| 3,228,515
|
public void throwCreationViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( iObject.getClass().getName() +" is a System-type, and may only be " +"created through privileged APIs."); }
|
public void throwCreationViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( iObject.getClass().getName() +" is a System-type, and may only be " +"created through privileged APIs."); }
| 3,228,516
|
public void throwCreationViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( iObject.getClass().getName() +" is a System-type, and may only be " +"created through privileged APIs."); }
|
public void throwCreationViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( iObject.getClass().getName() +" is a System-type, and may only be " +"created through privileged APIs."); }
| 3,228,517
|
public void throwDeleteViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Deleting "+iObject+" not allowed." ); }
|
public void throwDeleteViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Deleting "+iObject+" not allowed." ); }
| 3,228,518
|
public void throwDeleteViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Deleting "+iObject+" not allowed." ); }
|
public void throwDeleteViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Deleting "+iObject+" not allowed." ); }
| 3,228,519
|
public void throwLoadViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Cannot read "+iObject.getClass().getName()); }
|
public void throwLoadViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Cannot read "+iObject.getClass().getName()); }
| 3,228,520
|
public void throwLoadViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Cannot read "+iObject.getClass().getName()); }
|
public void throwLoadViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Cannot read "+iObject.getClass().getName()); }
| 3,228,521
|
public void throwUpdateViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Updating "+iObject+" not allowed." ); }
|
public void throwUpdateViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Updating "+iObject+" not allowed." ); }
| 3,228,522
|
public void throwUpdateViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Updating "+iObject+" not allowed." ); }
|
public void throwUpdateViolation( IObject iObject ) throws SecurityViolation { Assert.notNull(iObject); throw new SecurityViolation( "Updating "+iObject+" not allowed." ); }
| 3,228,523
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
| 3,228,524
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
| 3,228,525
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
| 3,228,526
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
| 3,228,527
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } if (source != null) { }
| 3,228,528
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); } } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); } } } return newDetails; }
|
public Details transientDetails( IObject obj ) { checkReady("transientDetails"); if ( hasPrivilegedToken( obj ) ) return obj.getDetails(); // EARLY EXIT Details source = obj.getDetails(); Details newDetails = CurrentDetails.createDetails(); if ( source != null ) { copyNonNullPermissions( newDetails, source.getPermissions() ); applyUmaskIfNecessary( newDetails ); // users *aren't* allowed to set the owner of an item. if (source.getOwner() != null && ! source.getOwner().getId().equals( newDetails.getOwner().getId() )) { // but this is root if ( currentUserIsAdmin() ) { newDetails.setOwner( source.getOwner() ); copyNonNullPermissions(newDetails, source.getPermissions()); applyUmaskIfNecessary(newDetails); if (source.getOwner() != null && !source.getOwner().getId().equals( newDetails.getOwner().getId())) { if (currentUserIsAdmin()) { newDetails.setOwner(source.getOwner()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner() .getId())); } } if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains(source.getGroup().getId())) { newDetails.setGroup(source.getGroup()); } else if (currentUserIsAdmin()) { newDetails.setGroup(source.getGroup()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID" + " for %s to %d", obj, source.getGroup() .getId())); } } } return newDetails; } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner().getId() )); copyNonNullPermissions(newDetails, source.getPermissions()); applyUmaskIfNecessary(newDetails); if (source.getOwner() != null && !source.getOwner().getId().equals( newDetails.getOwner().getId())) { if (currentUserIsAdmin()) { newDetails.setOwner(source.getOwner()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner() .getId())); } } if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains(source.getGroup().getId())) { newDetails.setGroup(source.getGroup()); } else if (currentUserIsAdmin()) { newDetails.setGroup(source.getGroup()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID" + " for %s to %d", obj, source.getGroup() .getId())); } } } return newDetails; } copyNonNullPermissions(newDetails, source.getPermissions()); applyUmaskIfNecessary(newDetails); if (source.getOwner() != null && !source.getOwner().getId().equals( newDetails.getOwner().getId())) { if (currentUserIsAdmin()) { newDetails.setOwner(source.getOwner()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner() .getId())); } } if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains(source.getGroup().getId())) { newDetails.setGroup(source.getGroup()); } else if (currentUserIsAdmin()) { newDetails.setGroup(source.getGroup()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID" + " for %s to %d", obj, source.getGroup() .getId())); } } } return newDetails; } // users are only allowed to set to another of their groups if (source.getGroup() != null && source.getGroup().getId() != null) { // users can change to their own group if (memberOfGroups().contains( source.getGroup().getId())) { newDetails.setGroup( source.getGroup() ); copyNonNullPermissions(newDetails, source.getPermissions()); applyUmaskIfNecessary(newDetails); if (source.getOwner() != null && !source.getOwner().getId().equals( newDetails.getOwner().getId())) { if (currentUserIsAdmin()) { newDetails.setOwner(source.getOwner()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner() .getId())); } } if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains(source.getGroup().getId())) { newDetails.setGroup(source.getGroup()); } else if (currentUserIsAdmin()) { newDetails.setGroup(source.getGroup()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID" + " for %s to %d", obj, source.getGroup() .getId())); } } } return newDetails; } // and admin can change it too else if ( currentUserIsAdmin() ) { newDetails.setGroup( source.getGroup() ); copyNonNullPermissions(newDetails, source.getPermissions()); applyUmaskIfNecessary(newDetails); if (source.getOwner() != null && !source.getOwner().getId().equals( newDetails.getOwner().getId())) { if (currentUserIsAdmin()) { newDetails.setOwner(source.getOwner()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner() .getId())); } } if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains(source.getGroup().getId())) { newDetails.setGroup(source.getGroup()); } else if (currentUserIsAdmin()) { newDetails.setGroup(source.getGroup()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID" + " for %s to %d", obj, source.getGroup() .getId())); } } } return newDetails; } // oops. boom! else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID"+ " for %s to %d", obj, source.getGroup().getId() )); copyNonNullPermissions(newDetails, source.getPermissions()); applyUmaskIfNecessary(newDetails); if (source.getOwner() != null && !source.getOwner().getId().equals( newDetails.getOwner().getId())) { if (currentUserIsAdmin()) { newDetails.setOwner(source.getOwner()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner() .getId())); } } if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains(source.getGroup().getId())) { newDetails.setGroup(source.getGroup()); } else if (currentUserIsAdmin()) { newDetails.setGroup(source.getGroup()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID" + " for %s to %d", obj, source.getGroup() .getId())); } } } return newDetails; } copyNonNullPermissions(newDetails, source.getPermissions()); applyUmaskIfNecessary(newDetails); if (source.getOwner() != null && !source.getOwner().getId().equals( newDetails.getOwner().getId())) { if (currentUserIsAdmin()) { newDetails.setOwner(source.getOwner()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner() .getId())); } } if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains(source.getGroup().getId())) { newDetails.setGroup(source.getGroup()); } else if (currentUserIsAdmin()) { newDetails.setGroup(source.getGroup()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID" + " for %s to %d", obj, source.getGroup() .getId())); } } } return newDetails; } copyNonNullPermissions(newDetails, source.getPermissions()); applyUmaskIfNecessary(newDetails); if (source.getOwner() != null && !source.getOwner().getId().equals( newDetails.getOwner().getId())) { if (currentUserIsAdmin()) { newDetails.setOwner(source.getOwner()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterID" + " for %s to %d", obj, source.getOwner() .getId())); } } if (source.getGroup() != null && source.getGroup().getId() != null) { if (memberOfGroups().contains(source.getGroup().getId())) { newDetails.setGroup(source.getGroup()); } else if (currentUserIsAdmin()) { newDetails.setGroup(source.getGroup()); } else { throw new SecurityViolation(String.format( "You are not authorized to set the ExperimenterGroupID" + " for %s to %d", obj, source.getGroup() .getId())); } } } return newDetails; } return newDetails; }
| 3,228,529
|
public static boolean isAdmin( ) { return isAdminHolder.get() == null ? false : isAdminHolder.get().booleanValue(); }
|
public static boolean isAdmin( ) { return isAdminHolder.get() == null ? false : isAdminHolder.get().booleanValue(); }
| 3,228,530
|
public static boolean addAllDisabled(String...ids) { Set<String> s = disabledSubsystemsHolder.get( ); if ( s == null ) { s = new HashSet<String>(); disabledSubsystemsHolder.set( s ); } if (ids != null ) { return Collections.addAll(s, ids); } return false; }
|
public static boolean addAllDisabled(String...ids) { Set<String> s = data.get().disabledSubsystems; if ( s == null ) { s = new HashSet<String>(); disabledSubsystemsHolder.set( s ); } if (ids != null ) { return Collections.addAll(s, ids); } return false; }
| 3,228,531
|
public static boolean addAllDisabled(String...ids) { Set<String> s = disabledSubsystemsHolder.get( ); if ( s == null ) { s = new HashSet<String>(); disabledSubsystemsHolder.set( s ); } if (ids != null ) { return Collections.addAll(s, ids); } return false; }
|
public static boolean addAllDisabled(String...ids) { Set<String> s = disabledSubsystemsHolder.get( ); if ( s == null ) { s = new HashSet<String>(); data.get().disabledSubsystems = s; } if (ids != null ) { return Collections.addAll(s, ids); } return false; }
| 3,228,532
|
public static void clearDisabled() { disabledSubsystemsHolder.remove(); }
|
public static void clearDisabled() { data.get().disabledSubsystems = null; }
| 3,228,533
|
public static boolean removeAllDisabled(String...ids) { Set<String> s = disabledSubsystemsHolder.get( ); if ( s != null && ids != null ) { boolean changed = false; for (String string : ids) { changed |= s.remove(string); } } return false; }
|
public static boolean removeAllDisabled(String...ids) { Set<String> s = data.get().disabledSubsystems; if ( s != null && ids != null ) { boolean changed = false; for (String string : ids) { changed |= s.remove(string); } } return false; }
| 3,228,534
|
public static boolean isDisabled(String id) { Set<String> s = disabledSubsystemsHolder.get( ); if ( s == null || id == null || ! s.contains(id)) return false; return true; }
|
public static boolean isDisabled(String id) { Set<String> s = data.get().disabledSubsystems; if ( s == null || id == null || ! s.contains(id)) return false; return true; }
| 3,228,535
|
public static Collection<Long> getLeaderOfGroups( ) { Collection<Long> c = leaderOfGroupsHolder.get(); if ( c == null || c.size() == 0 ) { c = Collections.singletonList(Long.MIN_VALUE); // FIXME hack as well. } return c; }
|
public static Collection<Long> getLeaderOfGroups( ) { Collection<Long> c = data.get().leaderOfGroups; if ( c == null || c.size() == 0 ) { c = Collections.singletonList(Long.MIN_VALUE); // FIXME hack as well. } return c; }
| 3,228,536
|
public static Set<IObject> getLockCandidates() { Set<IObject> s = lockCandidatesHolder.get(); if ( s == null ) return new HashSet<IObject>(); return s; }
|
public static Set<IObject> getLockCandidates() { Set<IObject> s = data.get().lockCandidates; if ( s == null ) return new HashSet<IObject>(); return s; }
| 3,228,537
|
void markLockedIfNecessary( IObject iObject, Details trustedDetails );
|
void markLockedIfNecessary( IObject iObject, Details trustedDetails );
| 3,228,538
|
public IObject[] getLockCandidates( IObject iObject ) { if ( iObject == null ) return new IObject[]{}; Holder h = classNameHolder.get( iObject.getClass().getName() ); return h.getLockCandidates( iObject ); }
|
public IObject[] getLockCandidates( IObject iObject ) { if ( iObject == null ) return new IObject[]{}; Holder h = classNameHolder.get( iObject.getClass().getName() ); return h.getLockCandidates( iObject ); }
| 3,228,539
|
public static void appendLockCandidates( Set<IObject> set ) { Set<IObject> s = lockCandidatesHolder.get(); if ( s == null ) { s = new HashSet<IObject>( ); lockCandidatesHolder.set( s ); } s.addAll( set ); }
|
public static void appendLockCandidates( Set<IObject> set ) { Set<IObject> s = data.get().lockCandidates; if ( s == null ) { s = new HashSet<IObject>( ); lockCandidatesHolder.set( s ); } s.addAll( set ); }
| 3,228,540
|
public static void appendLockCandidates( Set<IObject> set ) { Set<IObject> s = lockCandidatesHolder.get(); if ( s == null ) { s = new HashSet<IObject>( ); lockCandidatesHolder.set( s ); } s.addAll( set ); }
|
public static void appendLockCandidates( Set<IObject> set ) { Set<IObject> s = lockCandidatesHolder.get(); if ( s == null ) { s = new HashSet<IObject>( ); data.get().lockCandidates = s; } s.addAll( set ); }
| 3,228,541
|
public static Collection<Long> getMemberOfGroups( ) { Collection<Long> c = memberOfGroupsHolder.get(); if ( c == null || c.size() == 0 ) { c = Collections.singletonList(Long.MIN_VALUE); // FIXME hack as well. } return c; }
|
public static Collection<Long> getMemberOfGroups( ) { Collection<Long> c = data.get().memberOfGroups; if ( c == null || c.size() == 0 ) { c = Collections.singletonList(Long.MIN_VALUE); // FIXME hack as well. } return c; }
| 3,228,542
|
public static void setAdmin( boolean isAdmin ) { isAdminHolder.set( Boolean.valueOf(isAdmin)); }
|
public static void setAdmin( boolean isAdmin ) { data.get().isAdmin = isAdmin; }
| 3,228,543
|
public static void setMemberOfGroups( Collection<Long> groupIds ) { memberOfGroupsHolder.set( groupIds ); }
|
public static void setMemberOfGroups( Collection<Long> groupIds ) { data.get().memberOfGroups = groupIds; }
| 3,228,544
|
public static void setLeaderOfGroups( Collection<Long> groupIds ) { leaderOfGroupsHolder.set( groupIds ); }
|
public static void setLeaderOfGroups( Collection<Long> groupIds ) { data.get().leaderOfGroups = groupIds; }
| 3,228,545
|
public void accept(TreeImageDisplayVisitor visitor, int algoType) { if (visitor == null) throw new NullPointerException("No visitor."); if (!checkAlgoType(algoType)) throw new IllegalArgumentException("Algorithm not supported."); Iterator i = childrenDisplay.iterator(); TreeImageDisplay child; switch (algoType) { case TreeImageDisplayVisitor.TREEIMAGE_NODE_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } if (this instanceof TreeImageNode) doAccept(visitor); break; case TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); if (child instanceof TreeImageSet) child.accept(visitor, algoType); } if (this instanceof TreeImageSet) doAccept(visitor); break; case TreeImageDisplayVisitor.ALL_NODES: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } doAccept(visitor); break; } }
|
public void accept(TreeImageDisplayVisitor visitor) { if (visitor == null) throw new NullPointerException("No visitor."); if (!checkAlgoType(algoType)) throw new IllegalArgumentException("Algorithm not supported."); Iterator i = childrenDisplay.iterator(); TreeImageDisplay child; switch (algoType) { case TreeImageDisplayVisitor.TREEIMAGE_NODE_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } if (this instanceof TreeImageNode) doAccept(visitor); break; case TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); if (child instanceof TreeImageSet) child.accept(visitor, algoType); } if (this instanceof TreeImageSet) doAccept(visitor); break; case TreeImageDisplayVisitor.ALL_NODES: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } doAccept(visitor); break; } }
| 3,228,546
|
public void accept(TreeImageDisplayVisitor visitor, int algoType) { if (visitor == null) throw new NullPointerException("No visitor."); if (!checkAlgoType(algoType)) throw new IllegalArgumentException("Algorithm not supported."); Iterator i = childrenDisplay.iterator(); TreeImageDisplay child; switch (algoType) { case TreeImageDisplayVisitor.TREEIMAGE_NODE_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } if (this instanceof TreeImageNode) doAccept(visitor); break; case TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); if (child instanceof TreeImageSet) child.accept(visitor, algoType); } if (this instanceof TreeImageSet) doAccept(visitor); break; case TreeImageDisplayVisitor.ALL_NODES: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } doAccept(visitor); break; } }
|
public void accept(TreeImageDisplayVisitor visitor, int algoType) { if (visitor == null) throw new NullPointerException("No visitor."); if (!checkAlgoType(algoType)) throw new IllegalArgumentException("Algorithm not supported."); Iterator i = childrenDisplay.iterator(); TreeImageDisplay child; switch (algoType) { case TreeImageDisplayVisitor.TREEIMAGE_NODE_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } if (this instanceof TreeImageNode) doAccept(visitor); break; case TreeImageDisplayVisitor.TREEIMAGE_SET_ONLY: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); if (child instanceof TreeImageSet) child.accept(visitor, algoType); } if (this instanceof TreeImageSet) doAccept(visitor); break; case TreeImageDisplayVisitor.ALL_NODES: while (i.hasNext()) { child = (TreeImageDisplay) i.next(); child.accept(visitor, algoType); } doAccept(visitor); break; } }
| 3,228,547
|
public void setActiveBrowser(BrowserController browser) { synchronized(browserList) // will this lock? { int prevIndex = browserList.indexOf(browser)+1; browserList.add(0,browser); browserList.remove(prevIndex); } }
|
public void setActiveBrowser(UIWrapper browser) { synchronized(browserList) // will this lock? { int prevIndex = browserList.indexOf(browser)+1; browserList.add(0,browser); browserList.remove(prevIndex); } }
| 3,228,550
|
public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; }
|
public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; }
| 3,228,551
|
public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; }
|
public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); to75Actions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); to75Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); to75Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); to75Actions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); to75Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; }
| 3,228,552
|
public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; }
|
public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); to100Actions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); to100Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); to100Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); to100Actions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); to100Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; }
| 3,228,553
|
public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); defaultActions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; }
|
public static BPalette getZoomPalette(final BrowserModel backingModel, final BrowserTopModel model) { if(backingModel == null || model == null) { return null; } BPalette palette = new BPalette(model,"Zoom"); BIcon toFitIcon = new BIcon("Fit",false); MouseDownActions defaultActions = new MouseDownActions(); PiccoloAction toFitAction = PiccoloActionFactory.getZoomToFitAction(backingModel); to200Actions.setMouseClickAction(PiccoloModifiers.NORMAL, toFitAction); toFitIcon.setMouseDownActions(defaultActions); palette.addIcon(toFitIcon); BIcon to50Icon = new BIcon("50%",false); MouseDownActions to50Actions = new MouseDownActions(); PiccoloAction to50Action = PiccoloActionFactory.getZoomTo50Action(backingModel); to200Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to50Action); to50Icon.setMouseDownActions(to50Actions); palette.addIcon(to50Icon); BIcon to75Icon = new BIcon("75%",false); MouseDownActions to75Actions = new MouseDownActions(); PiccoloAction to75Action = PiccoloActionFactory.getZoomTo75Action(backingModel); to200Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to75Action); to75Icon.setMouseDownActions(to75Actions); palette.addIcon(to75Icon); BIcon to100Icon = new BIcon("100%",false); MouseDownActions to100Actions = new MouseDownActions(); PiccoloAction toActualAction = PiccoloActionFactory.getZoomToActualAction(backingModel); to200Actions.setMouseClickAction(PiccoloModifiers.NORMAL, toActualAction); to100Icon.setMouseDownActions(to100Actions); palette.addIcon(to100Icon); BIcon to200Icon = new BIcon("200%",false); MouseDownActions to200Actions = new MouseDownActions(); PiccoloAction to200Action = PiccoloActionFactory.getZoomTo200Action(backingModel); to200Actions.setMouseClickAction(PiccoloModifiers.NORMAL, to200Action); to50Icon.setMouseDownActions(to200Actions); palette.addIcon(to200Icon); return palette; }
| 3,228,554
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.