rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
public void put(Token token) { if ( tokens.get() == null ) tokens.set( new IdentityHashMap<Token,Token>() );
public void put(Token token) { if (tokens.get() == null) tokens.set(new IdentityHashMap<Token, Token>());
public void put(Token token) { if ( tokens.get() == null ) tokens.set( new IdentityHashMap<Token,Token>() ); tokens.get().put(token, token); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void remove(Token t) { if ( tokens.get() == null ) return;
public void remove(Token t) { if (tokens.get() == null) return;
public void remove(Token t) { if ( tokens.get() == null ) return; tokens.get().remove(t); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public BasicSecuritySystem( ServiceFactory factory, EventContext eventContext) {
public BasicSecuritySystem(ServiceFactory factory, EventContext eventContext) {
public BasicSecuritySystem( ServiceFactory factory, EventContext eventContext) { Assert.notNull(factory); Assert.notNull(eventContext); this.sf = factory; this.ec = eventContext; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void addLog( String action, Class klass, Long id ) {
public void addLog(String action, Class klass, Long id) {
public void addLog( String action, Class klass, Long id ) { Assert.notNull(action); Assert.notNull(klass); Assert.notNull(id); if ( Event.class.isAssignableFrom( klass ) || EventLog.class.isAssignableFrom( klass ) || EventDiff.class.isAssignableFrom( klass ) ) { log.debug( "Not logging creation of logging type:"+klass); } else { checkReady("addLog"); log.info("Adding log:"+action+","+klass+","+id); EventLog l = new EventLog(); l.setAction(action); l.setType(klass.getName()); // TODO could be id to Type entity l.setIdList(id.toString()); l.setDetails(CurrentDetails.createDetails()); l.getGraphHolder().setToken(null, token); CurrentDetails.getCreationEvent().addEventLog( l ); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
Assert.notNull(action); Assert.notNull(klass); Assert.notNull(id); if ( Event.class.isAssignableFrom( klass ) || EventLog.class.isAssignableFrom( klass ) || EventDiff.class.isAssignableFrom( klass ) ) { log.debug( "Not logging creation of logging type:"+klass); } else { checkReady("addLog"); log.info("Adding log:"+action+","+klass+","+id); EventLog l = new EventLog(); l.setAction(action); l.setType(klass.getName()); l.setIdList(id.toString()); l.setDetails(CurrentDetails.createDetails()); l.getGraphHolder().setToken(null, token); CurrentDetails.getCreationEvent().addEventLog( l ); } }
Assert.notNull(action); Assert.notNull(klass); Assert.notNull(id); if (Event.class.isAssignableFrom(klass) || EventLog.class.isAssignableFrom(klass) || EventDiff.class.isAssignableFrom(klass)) { log.debug("Not logging creation of logging type:" + klass); } else { checkReady("addLog"); log.info("Adding log:" + action + "," + klass + "," + id); EventLog l = new EventLog(); l.setAction(action); l.setType(klass.getName()); l.setIdList(id.toString()); l.setDetails(CurrentDetails.createDetails()); l.getGraphHolder().setToken(null, token); CurrentDetails.getCreationEvent().addEventLog(l); } }
public void addLog( String action, Class klass, Long id ) { Assert.notNull(action); Assert.notNull(klass); Assert.notNull(id); if ( Event.class.isAssignableFrom( klass ) || EventLog.class.isAssignableFrom( klass ) || EventDiff.class.isAssignableFrom( klass ) ) { log.debug( "Not logging creation of logging type:"+klass); } else { checkReady("addLog"); log.info("Adding log:"+action+","+klass+","+id); EventLog l = new EventLog(); l.setAction(action); l.setType(klass.getName()); // TODO could be id to Type entity l.setIdList(id.toString()); l.setDetails(CurrentDetails.createDetails()); l.getGraphHolder().setToken(null, token); CurrentDetails.getCreationEvent().addEventLog( l ); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public boolean allowCreation( IObject iObject ) {
public boolean allowCreation(IObject iObject) {
public boolean allowCreation( IObject iObject ) { Assert.notNull(iObject); Class cls = iObject.getClass(); if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) { return true; } else if ( isSystemType( (Class<? extends IObject>) cls )) { return false; } return true; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) {
if (hasPrivilegedToken(iObject) || currentUserIsAdmin()) {
public boolean allowCreation( IObject iObject ) { Assert.notNull(iObject); Class cls = iObject.getClass(); if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) { return true; } else if ( isSystemType( (Class<? extends IObject>) cls )) { return false; } return true; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
else if ( isSystemType( (Class<? extends IObject>) cls )) {
else if (isSystemType((Class<? extends IObject>) cls)) {
public boolean allowCreation( IObject iObject ) { Assert.notNull(iObject); Class cls = iObject.getClass(); if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) { return true; } else if ( isSystemType( (Class<? extends IObject>) cls )) { return false; } return true; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public boolean allowCreation( IObject iObject ) { Assert.notNull(iObject); Class cls = iObject.getClass(); if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) { return true; } else if ( isSystemType( (Class<? extends IObject>) cls )) { return false; } return true; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public boolean allowDelete( IObject iObject, Details trustedDetails ) { return allowUpdateOrDelete(iObject,trustedDetails);
public boolean allowDelete(IObject iObject, Details trustedDetails) { return allowUpdateOrDelete(iObject, trustedDetails);
public boolean allowDelete( IObject iObject, Details trustedDetails ) { return allowUpdateOrDelete(iObject,trustedDetails); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public boolean allowLoad( Class<? extends IObject> klass, Details d ) {
public boolean allowLoad(Class<? extends IObject> klass, Details d) {
public boolean allowLoad( Class<? extends IObject> klass, Details d ) { Assert.notNull(klass); Assert.notNull(d); if ( isSystemType(klass)) return true; return SecurityFilter.passesFilter(this, d); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( isSystemType(klass)) return true;
if (isSystemType(klass)) return true;
public boolean allowLoad( Class<? extends IObject> klass, Details d ) { Assert.notNull(klass); Assert.notNull(d); if ( isSystemType(klass)) return true; return SecurityFilter.passesFilter(this, d); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public boolean allowUpdate( IObject iObject, Details trustedDetails ) { return allowUpdateOrDelete(iObject,trustedDetails);
public boolean allowUpdate(IObject iObject, Details trustedDetails) { return allowUpdateOrDelete(iObject, trustedDetails);
public boolean allowUpdate( IObject iObject, Details trustedDetails ) { return allowUpdateOrDelete(iObject,trustedDetails); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) {
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) {
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) {
if (hasPrivilegedToken(iObject) || currentUserIsAdmin()) return true; else if (isSystemType((Class<? extends IObject>) iObject.getClass())) {
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( d == null ) return true;
if (d == null) return true;
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( g != null && leaderOfGroups().contains(g)) return true;
if (g != null && leaderOfGroups().contains(g)) return true;
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value.");
if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value.");
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true;
if (p.isGranted(WORLD, WRITE)) return true; if (p.isGranted(USER, WRITE) && o != null && o.equals(currentUserId())) return true; if (p.isGranted(GROUP, WRITE) && g != null && memberOfGroups().contains(g)) return true;
private boolean allowUpdateOrDelete(IObject iObject, Details trustedDetails) { Assert.notNull(iObject); // needs no details info if ( hasPrivilegedToken( iObject ) || currentUserIsAdmin() ) return true; else if ( isSystemType( (Class<? extends IObject>) iObject.getClass())) { return false; } // previously we were taking the details directly from iObject // iObject, however, is in a critical state. Values such as // Permissions, owner, and group may have been changed. Details d = trustedDetails; // this can now only happen if a table doesn't have permissions // and there aren't any of those. so let it be updated. if ( d == null ) return true; Long o = d.getOwner() == null ? null : d.getOwner().getId(); Long g = d.getGroup() == null ? null : d.getGroup().getId(); // needs no permissions info if ( g != null && leaderOfGroups().contains(g)) return true; Permissions p = d.getPermissions(); // this should never occur. if (p == null) { throw new InternalException( "Permissions null! Security system " + "failure -- refusing to continue. The Permissions should " + "be set to a default value."); } // standard if ( p.isGranted(WORLD,WRITE)) return true; if ( p.isGranted(USER, WRITE) && o!=null && o.equals(currentUserId())) return true; if ( p.isGranted(GROUP, WRITE) && g!=null && memberOfGroups().contains(g)) return true; return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
void applyUmaskIfNecessary( Details d ) { Permissions p = d.getPermissions(); if ( p.isSet( Flag.SOFT) ) { if ( ec.getPrincipal().hasUmask() ) { p.grantAll( ec.getPrincipal().getUmask() ); p.revokeAll( ec.getPrincipal().getUmask() ); } p.unSet( Flag.SOFT ); } }
void applyUmaskIfNecessary(Details d) { Permissions p = d.getPermissions(); if (p.isSet(Flag.SOFT)) { if (ec.getPrincipal().hasUmask()) { p.grantAll(ec.getPrincipal().getUmask()); p.revokeAll(ec.getPrincipal().getUmask()); } p.unSet(Flag.SOFT); } }
void applyUmaskIfNecessary( Details d ) { Permissions p = d.getPermissions(); if ( p.isSet( Flag.SOFT) ) { if ( ec.getPrincipal().hasUmask() ) { p.grantAll( ec.getPrincipal().getUmask() ); p.revokeAll( ec.getPrincipal().getUmask() ); } // don't store it in the DB. p.unSet( Flag.SOFT ); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
protected void checkReady(String method) { if (!isReady()) { throw new ApiUsageException("The security system is not ready.\n" + "Cannot execute: "+method); }
protected void checkReady(String method) { if (!isReady()) { throw new ApiUsageException("The security system is not ready.\n" + "Cannot execute: " + method); }
protected void checkReady(String method) { if (!isReady()) { throw new ApiUsageException("The security system is not ready.\n" + "Cannot execute: "+method); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
}
}
protected void checkReady(String method) { if (!isReady()) { throw new ApiUsageException("The security system is not ready.\n" + "Cannot execute: "+method); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void clearCurrentDetails() {
public void clearCurrentDetails() {
public void clearCurrentDetails() { CurrentDetails.clear(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
boolean copyNonNullPermissions( Details target, Permissions p ) { if (p != null ) { target.setPermissions( p ); return true; } return false; }
boolean copyNonNullPermissions(Details target, Permissions p) { if (p != null) { target.setPermissions(p); return true; } return false; }
boolean copyNonNullPermissions( Details target, Permissions p ) { if (p != null ) { target.setPermissions( p ); return true; } return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( source == null || copy == null || source == copy)
if (source == null || copy == null || source == copy)
public void copyToken(IObject source, IObject copy) { if ( source == null || copy == null || source == copy) return; GraphHolder gh1 = source.getGraphHolder(); GraphHolder gh2 = copy.getGraphHolder(); // try our token first if ( gh1.tokenMatches(token)) { gh2.setToken(token,token); } else // now we'll have to loop through { Token t = oneTimeTokens.find(gh1); if ( t != null ) { gh2.setToken(t, t); } } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void copyToken(IObject source, IObject copy) { if ( source == null || copy == null || source == copy) return; GraphHolder gh1 = source.getGraphHolder(); GraphHolder gh2 = copy.getGraphHolder(); // try our token first if ( gh1.tokenMatches(token)) { gh2.setToken(token,token); } else // now we'll have to loop through { Token t = oneTimeTokens.find(gh1); if ( t != null ) { gh2.setToken(t, t); } } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void copyToken(IObject source, IObject copy) { if ( source == null || copy == null || source == copy) return; GraphHolder gh1 = source.getGraphHolder(); GraphHolder gh2 = copy.getGraphHolder(); // try our token first if ( gh1.tokenMatches(token)) { gh2.setToken(token,token); } else // now we'll have to loop through { Token t = oneTimeTokens.find(gh1); if ( t != null ) { gh2.setToken(t, t); } } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( gh1.tokenMatches(token)) { gh2.setToken(token,token);
if (gh1.tokenMatches(token)) { gh2.setToken(token, token);
public void copyToken(IObject source, IObject copy) { if ( source == null || copy == null || source == copy) return; GraphHolder gh1 = source.getGraphHolder(); GraphHolder gh2 = copy.getGraphHolder(); // try our token first if ( gh1.tokenMatches(token)) { gh2.setToken(token,token); } else // now we'll have to loop through { Token t = oneTimeTokens.find(gh1); if ( t != null ) { gh2.setToken(t, t); } } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void copyToken(IObject source, IObject copy) { if ( source == null || copy == null || source == copy) return; GraphHolder gh1 = source.getGraphHolder(); GraphHolder gh2 = copy.getGraphHolder(); // try our token first if ( gh1.tokenMatches(token)) { gh2.setToken(token,token); } else // now we'll have to loop through { Token t = oneTimeTokens.find(gh1); if ( t != null ) { gh2.setToken(t, t); } } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( t != null ) {
if (t != null) {
public void copyToken(IObject source, IObject copy) { if ( source == null || copy == null || source == copy) return; GraphHolder gh1 = source.getGraphHolder(); GraphHolder gh2 = copy.getGraphHolder(); // try our token first if ( gh1.tokenMatches(token)) { gh2.setToken(token,token); } else // now we'll have to loop through { Token t = oneTimeTokens.find(gh1); if ( t != null ) { gh2.setToken(t, t); } } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public Event currentEvent() {
public Event currentEvent() {
public Event currentEvent() { checkReady("currentEvent"); return CurrentDetails.getCreationEvent(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public ExperimenterGroup currentGroup() {
public ExperimenterGroup currentGroup() {
public ExperimenterGroup currentGroup() { checkReady("currentGroup"); return CurrentDetails.getGroup(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public Long currentGroupId() {
public Long currentGroupId() {
public Long currentGroupId() { checkReady("currentGroupId"); return CurrentDetails.getGroup().getId(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public Experimenter currentUser() {
public Experimenter currentUser() {
public Experimenter currentUser() { checkReady("currentUser"); return CurrentDetails.getOwner(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public Long currentUserId() {
public Long currentUserId() {
public Long currentUserId() { checkReady("currentUserId"); return CurrentDetails.getOwner().getId(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public boolean currentUserIsAdmin() {
public boolean currentUserIsAdmin() {
public boolean currentUserIsAdmin() { checkReady("currentUserIsAdmin"); return CurrentDetails.isAdmin(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void disable(String...ids) { if (ids==null || ids.length==0)
public void disable(String... ids) { if (ids == null || ids.length == 0)
public void disable(String...ids) { if (ids==null || ids.length==0) throw new ApiUsageException("Ids should not be empty."); CurrentDetails.addAllDisabled(ids); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void disableReadFilter( Object session ) {
public void disableReadFilter(Object session) {
public void disableReadFilter( Object session ) { checkReady("disableReadFilter"); Session sess = (Session) session; sess.disableFilter(SecurityFilter.filterName); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void disableReadFilter( Object session ) { checkReady("disableReadFilter"); Session sess = (Session) session; sess.disableFilter(SecurityFilter.filterName); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
obj.getGraphHolder().setToken(token,token);
obj.getGraphHolder().setToken(token, token);
public <T extends IObject> T doAction(T obj, SecureAction action) { Assert.notNull(obj); Assert.notNull(action);// FIXME// Token oneTimeToken = new Token();// oneTimeTokens.put(oneTimeToken); obj.getGraphHolder().setToken(token,token);//oneTimeToken); T retVal; try { retVal = action.updateObject(obj); } finally { obj.getGraphHolder().setToken(token,null); } return retVal; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
try {
try {
public <T extends IObject> T doAction(T obj, SecureAction action) { Assert.notNull(obj); Assert.notNull(action);// FIXME// Token oneTimeToken = new Token();// oneTimeTokens.put(oneTimeToken); obj.getGraphHolder().setToken(token,token);//oneTimeToken); T retVal; try { retVal = action.updateObject(obj); } finally { obj.getGraphHolder().setToken(token,null); } return retVal; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
obj.getGraphHolder().setToken(token,null);
obj.getGraphHolder().setToken(token, null);
public <T extends IObject> T doAction(T obj, SecureAction action) { Assert.notNull(obj); Assert.notNull(action);// FIXME// Token oneTimeToken = new Token();// oneTimeTokens.put(oneTimeToken); obj.getGraphHolder().setToken(token,token);//oneTimeToken); T retVal; try { retVal = action.updateObject(obj); } finally { obj.getGraphHolder().setToken(token,null); } return retVal; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public boolean emptyDetails( ) { return CurrentDetails.getOwner() == null && CurrentDetails.getGroup() == null && CurrentDetails.getCreationEvent() == null; }
public boolean emptyDetails() { return CurrentDetails.getOwner() == null && CurrentDetails.getGroup() == null && CurrentDetails.getCreationEvent() == null; }
public boolean emptyDetails( ) { return CurrentDetails.getOwner() == null && CurrentDetails.getGroup() == null && CurrentDetails.getCreationEvent() == null; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if (ids==null || ids.length==0 ) CurrentDetails.clearDisabled();
if (ids == null || ids.length == 0) CurrentDetails.clearDisabled();
public void enable(String... ids) { if (ids==null || ids.length==0 ) CurrentDetails.clearDisabled(); CurrentDetails.removeAllDisabled(ids); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void enableReadFilter( Object session ) { if ( session == null || ! (session instanceof Session) ) { throw new ApiUsageException("The Object argument to enableReadFilter" + " in the BasicSystemSecurity implementation must be a " + " non-null org.hibernate.Session.");
public void enableReadFilter(Object session) { if (session == null || !(session instanceof Session)) { throw new ApiUsageException( "The Object argument to enableReadFilter" + " in the BasicSystemSecurity implementation must be a " + " non-null org.hibernate.Session.");
public void enableReadFilter( Object session ) { if ( session == null || ! (session instanceof Session) ) { throw new ApiUsageException("The Object argument to enableReadFilter" + " in the BasicSystemSecurity implementation must be a " + " non-null org.hibernate.Session."); } checkReady("enableReadFilter"); // beware http://opensource.atlassian.com/projects/hibernate/browse/HHH-1932 Session sess = (Session) session; sess.enableFilter(SecurityFilter.filterName) .setParameter( SecurityFilter.is_admin, currentUserIsAdmin()) .setParameter( SecurityFilter.current_user, currentUserId()) .setParameterList( SecurityFilter.current_groups, memberOfGroups()) .setParameterList( SecurityFilter.leader_of_groups, leaderOfGroups()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void enableReadFilter( Object session ) { if ( session == null || ! (session instanceof Session) ) { throw new ApiUsageException("The Object argument to enableReadFilter" + " in the BasicSystemSecurity implementation must be a " + " non-null org.hibernate.Session."); } checkReady("enableReadFilter"); // beware http://opensource.atlassian.com/projects/hibernate/browse/HHH-1932 Session sess = (Session) session; sess.enableFilter(SecurityFilter.filterName) .setParameter( SecurityFilter.is_admin, currentUserIsAdmin()) .setParameter( SecurityFilter.current_user, currentUserId()) .setParameterList( SecurityFilter.current_groups, memberOfGroups()) .setParameterList( SecurityFilter.leader_of_groups, leaderOfGroups()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void enableReadFilter( Object session ) { if ( session == null || ! (session instanceof Session) ) { throw new ApiUsageException("The Object argument to enableReadFilter" + " in the BasicSystemSecurity implementation must be a " + " non-null org.hibernate.Session."); } checkReady("enableReadFilter"); // beware http://opensource.atlassian.com/projects/hibernate/browse/HHH-1932 Session sess = (Session) session; sess.enableFilter(SecurityFilter.filterName) .setParameter( SecurityFilter.is_admin, currentUserIsAdmin()) .setParameter( SecurityFilter.current_user, currentUserId()) .setParameterList( SecurityFilter.current_groups, memberOfGroups()) .setParameterList( SecurityFilter.leader_of_groups, leaderOfGroups()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
sess.enableFilter(SecurityFilter.filterName) .setParameter( SecurityFilter.is_admin, currentUserIsAdmin()) .setParameter( SecurityFilter.current_user, currentUserId()) .setParameterList( SecurityFilter.current_groups, memberOfGroups()) .setParameterList( SecurityFilter.leader_of_groups, leaderOfGroups());
sess.enableFilter(SecurityFilter.filterName).setParameter( SecurityFilter.is_admin, currentUserIsAdmin()).setParameter( SecurityFilter.current_user, currentUserId()).setParameterList( SecurityFilter.current_groups, memberOfGroups()) .setParameterList(SecurityFilter.leader_of_groups, leaderOfGroups());
public void enableReadFilter( Object session ) { if ( session == null || ! (session instanceof Session) ) { throw new ApiUsageException("The Object argument to enableReadFilter" + " in the BasicSystemSecurity implementation must be a " + " non-null org.hibernate.Session."); } checkReady("enableReadFilter"); // beware http://opensource.atlassian.com/projects/hibernate/browse/HHH-1932 Session sess = (Session) session; sess.enableFilter(SecurityFilter.filterName) .setParameter( SecurityFilter.is_admin, currentUserIsAdmin()) .setParameter( SecurityFilter.current_user, currentUserId()) .setParameterList( SecurityFilter.current_groups, memberOfGroups()) .setParameterList( SecurityFilter.leader_of_groups, leaderOfGroups()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public Event getCurrentEvent() {
public Event getCurrentEvent() {
public Event getCurrentEvent() { checkReady("getCurrentEvent"); return CurrentDetails.getCreationEvent(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public long getRootId() { return 0L; }
public long getRootId() { return 0L; }
public long getRootId() { return 0L; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public String getRootName() { return "root"; }
public String getRootName() { return "root"; }
public String getRootName() { return "root"; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public long getSystemGroupId() { return 0L; }
public long getSystemGroupId() { return 0L; }
public long getSystemGroupId() { return 0L; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public String getSystemGroupName( ) { return "system";}
public String getSystemGroupName() { return "system"; }
public String getSystemGroupName( ) { return "system";}
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public long getUserGroupId() { return 1L; }
public long getUserGroupId() { return 1L; }
public long getUserGroupId() { return 1L; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public String getUserGroupName( ) { return "user"; }
public String getUserGroupName() { return "user"; }
public String getUserGroupName( ) { return "user"; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
private boolean hasPrivilegedToken( IObject obj ) {
private boolean hasPrivilegedToken(IObject obj) {
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( gh.hasToken() ) {
if (gh.hasToken()) {
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if (gh.tokenMatches(token)) return true;
if (gh.tokenMatches(token)) return true;
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( t != null ) {
if (t != null) {
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
gh.setToken(t,null);
gh.setToken(t, null);
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
}
}
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
protected boolean idEqual( IObject arg1, IObject arg2 ) { if ( arg1 == null ) { if ( arg2 == null ) return true; return false; } else if ( arg2 == null ) return false; Long arg1_id = arg1.getId(); Long arg2_id = arg2.getId(); if ( arg1_id == null ) { if ( arg2_id == null ) return true; return false; } else if ( arg2_id == null ) return false; else return arg1_id.equals( arg2_id ); }
protected boolean idEqual(IObject arg1, IObject arg2) { if (arg1 == null) { if (arg2 == null) return true; return false; } else if (arg2 == null) return false; Long arg1_id = arg1.getId(); Long arg2_id = arg2.getId(); if (arg1_id == null) { if (arg2_id == null) return true; return false; } else if (arg2_id == null) return false; 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 ); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if (id==null) throw new ApiUsageException("Id should not be null.");
if (id == null) throw new ApiUsageException("Id should not be null.");
public boolean isDisabled(String id) { if (id==null) throw new ApiUsageException("Id should not be null."); return CurrentDetails.isDisabled(id); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
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;
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;
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public boolean isReady( ) {
public boolean isReady() {
public boolean isReady( ) { // TODO could check for open session. if ( CurrentDetails.getCreationEvent() != null && CurrentDetails.getGroup() != null && CurrentDetails.getOwner() != null ) { return true; } return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( CurrentDetails.getCreationEvent() != null && CurrentDetails.getGroup() != null && CurrentDetails.getOwner() != null ) {
if (CurrentDetails.getCreationEvent() != null && CurrentDetails.getGroup() != null && CurrentDetails.getOwner() != null) {
public boolean isReady( ) { // TODO could check for open session. if ( CurrentDetails.getCreationEvent() != null && CurrentDetails.getGroup() != null && CurrentDetails.getOwner() != null ) { return true; } return false; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
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());
public boolean isSystemGroup( ExperimenterGroup group ) { return group == null || group.getId() == null? false : group.getId().equals( getSystemGroupId() ); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
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;
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;
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public Collection<Long> leaderOfGroups() {
public Collection<Long> leaderOfGroups() {
public Collection<Long> leaderOfGroups() { checkReady("leaderOfGroups"); return CurrentDetails.getLeaderOfGroups(); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void lockMarked( ) {
public void lockMarked() {
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 ); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
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 ); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
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 ); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
Permissions p = new Permissions( d.getPermissions() ); p.set( Flag.LOCKED ); d.setPermissions( p );
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 ); } }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public Details managedDetails( final IObject iobj, final Details previousDetails ) { checkReady("managedDetails"); if ( iobj.getId() == null) throw new ValidationException( "Id required on all detached instances.");
public Details managedDetails(final IObject iobj, final Details previousDetails) { checkReady("managedDetails");
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
boolean altered = false;
if (iobj.getId() == null) throw new ValidationException( "Id required on all detached instances.");
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
final Details currentDetails = iobj.getDetails(); /* not final! */ Details newDetails = CurrentDetails.createDetails(); if ( previousDetails == null ) { if ( currentDetails != null ) { newDetails = null; altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to null like original"); } } }
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
else if ( currentDetails == null ) { newDetails = new Details( previousDetails ); altered = true; if ( log.isDebugEnabled() ) { log.debug("Setting details on "+ iobj+" to copy of original details."); } } else { boolean locked = false; boolean privileged = false; if ( previousDetails.getPermissions().isSet( Flag.LOCKED )) locked = true; if ( hasPrivilegedToken( iobj )) privileged = true; altered |= managedPermissions( locked, privileged, iobj, previousDetails, currentDetails, newDetails); if ( ! isGlobal( iobj.getClass() )) { altered |= managedOwner( locked, privileged, iobj, previousDetails, currentDetails, newDetails); }
boolean altered = false;
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( ! isGlobal( iobj.getClass() )) { altered |= managedGroup( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if ( ! isGlobal( iobj.getClass() )) { altered |= managedEvent( locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if ( iobj instanceof IMutable ) { Integer version = ((IMutable) iobj).getVersion(); if ( version == null || version.intValue() < 0 ); } return altered ? newDetails : previousDetails; }
final Details currentDetails = iobj.getDetails(); /* not final! */Details newDetails = CurrentDetails.createDetails(); if (previousDetails == null) { if (currentDetails != null) { newDetails = null; altered = true; if (log.isDebugEnabled()) { log.debug("Setting details on " + iobj + " to null like original"); } } } else if (currentDetails == null) { newDetails = new Details(previousDetails); altered = true; if (log.isDebugEnabled()) { log.debug("Setting details on " + iobj + " to copy of original details."); } } else { boolean locked = false; boolean privileged = false; if (previousDetails.getPermissions().isSet(Flag.LOCKED)) locked = true; if (hasPrivilegedToken(iobj)) privileged = true; altered |= managedPermissions(locked, privileged, iobj, previousDetails, currentDetails, newDetails); if (!isGlobal(iobj.getClass())) { altered |= managedOwner(locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if (!isGlobal(iobj.getClass())) { altered |= managedGroup(locked, privileged, iobj, previousDetails, currentDetails, newDetails); } if (!isGlobal(iobj.getClass())) { altered |= managedEvent(locked, privileged, iobj, previousDetails, currentDetails, newDetails); } } if (iobj instanceof IMutable) { Integer version = ((IMutable) iobj).getVersion(); if (version == null || version.intValue() < 0) ; } 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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
protected boolean managedEvent( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { if ( ! idEqual( previousDetails.getCreationEvent(), currentDetails.getCreationEvent())) { 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() )); } 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())) { 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())); } 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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
protected boolean managedGroup( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { if (! idEqual( previousDetails.getGroup(), currentDetails.getGroup() )) {
protected boolean managedGroup(boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) { if (!idEqual(previousDetails.getGroup(), currentDetails.getGroup())) {
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( locked ) { throw new SecurityViolation( "Cannot change group for entity:" + obj ); }
if (locked) { throw new SecurityViolation("Cannot change group for entity:" + obj); }
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
else if ( currentDetails.getGroup() == null ) { newDetails.setGroup( previousDetails.getGroup() ); return true; }
else if (currentDetails.getGroup() == null) { newDetails.setGroup(previousDetails.getGroup()); return true; }
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
else if ( memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged ) { newDetails.setGroup( currentDetails.getGroup());
else if (memberOfGroups().contains( currentDetails.getGroup().getId()) || currentUserIsAdmin() || privileged) { newDetails.setGroup(currentDetails.getGroup());
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
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() )); } }
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())); } }
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
newDetails.setGroup( previousDetails.getGroup());
newDetails.setGroup(previousDetails.getGroup());
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
}
}
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
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 ); } else if ( currentUserIsAdmin() || privileged ) { if ( currentDetails.getOwner() == null ) { newDetails.setOwner( previousDetails.getOwner() ); return true; } } 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 { 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); } else if (currentUserIsAdmin() || privileged) { if (currentDetails.getOwner() == null) { newDetails.setOwner(previousDetails.getOwner()); return true; } } 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 { 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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
protected boolean managedPermissions( boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) {
protected boolean managedPermissions(boolean locked, boolean privileged, IObject obj, Details previousDetails, Details currentDetails, Details newDetails) {
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
boolean altered = false; Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails.getPermissions();
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
if ( previousP == null ) { if ( currentP == null ) { newDetails.setPermissions( null ); altered |= false; } else { newDetails.setPermissions( currentP ); altered = true; } } else if ( currentP == null || currentP.isSet( Flag.SOFT )) { newDetails.setPermissions( previousP ); altered = true; }
boolean altered = false;
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
else { newDetails.setPermissions( currentP ); if ( ! currentP.identical( previousP ) ) { altered = true; } } if ( locked ) {
Permissions previousP = previousDetails == null ? null : previousDetails.getPermissions(); Permissions currentP = currentDetails == null ? null : currentDetails .getPermissions(); if (previousP == null) { if (currentP == null) { newDetails.setPermissions(null); altered |= false; } else { newDetails.setPermissions(currentP); altered = true; } } else if (currentP == null || currentP.isSet(Flag.SOFT)) { newDetails.setPermissions(previousP); altered = true; } else { newDetails.setPermissions(currentP); if (!currentP.identical(previousP)) { altered = true; } } if (locked) {
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
Permissions newP = newDetails.getPermissions(); if ( newP != null ) { 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)))
Permissions calculatedP = newDetails.getPermissions(); if (calculatedP != null) { if ( ! calculatedP.isSet( Flag.LOCKED )) { calculatedP.set(Flag.LOCKED); altered = true; } if ((previousP.isGranted(USER, READ) && !calculatedP.isGranted(USER, READ)) || (previousP.isGranted(GROUP, READ) && !calculatedP .isGranted(GROUP, READ)) || (previousP.isGranted(WORLD, READ) && !calculatedP .isGranted(WORLD, READ)))
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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
"Cannot remove READ from locked entity:" + obj) ; } } return altered; }
"Cannot remove READ from locked entity:" + obj); } } 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; }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java
public void markLockedIfNecessary( IObject iObject, Details trustedDetails ) { if ( iObject == null ) return;
public void markLockedIfNecessary(IObject iObject) { if (iObject == null) return;
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 ); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/9c53370b3f7a88f29e38673527398c205d19f7d6/BasicSecuritySystem.java/buggy/components/server/src/ome/security/BasicSecuritySystem.java