the permissions system was screwing up somehow for static permissions -
EnvUser, EnvCommunity, and EnvConference each need to keep a reference to their own SecurityMonitor, we can't rely on getStaticMonitor() (but we still need it, to make the other "wrapper" functions work)
This commit is contained in:
parent
a376aad722
commit
41299f6d85
|
@ -967,7 +967,12 @@ class TopicMessageUserContextImpl implements TopicMessageContext
|
|||
public boolean canPublish()
|
||||
{
|
||||
if (!(env.testPermission(EnvUser.PERM_PUBLISH_FP)))
|
||||
return false; // must be a sysadmin to publish
|
||||
{ // must be a sysadmin to publish
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("canPublish(): permission test failed");
|
||||
return false;
|
||||
|
||||
} // end if
|
||||
if ((scribble_date!=null) || nuked)
|
||||
return false; // cannot publish a scribbled or nuked message
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ public class EnvCommunity extends EnvUser
|
|||
*/
|
||||
|
||||
private CommunityBackend comm; // the community back end
|
||||
private SecurityMonitor sm; // the security monitor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructors
|
||||
|
@ -55,6 +56,7 @@ public class EnvCommunity extends EnvUser
|
|||
{
|
||||
super(parent);
|
||||
this.comm = comm;
|
||||
this.sm = getEngine().env_getSecurityMonitor(EngineBackend.SM_COMMUNITY);
|
||||
|
||||
} // end constructor
|
||||
|
||||
|
@ -62,6 +64,7 @@ public class EnvCommunity extends EnvUser
|
|||
{
|
||||
super(other);
|
||||
this.comm = other.comm;
|
||||
this.sm = other.sm;
|
||||
|
||||
} // end constructor
|
||||
|
||||
|
@ -72,7 +75,7 @@ public class EnvCommunity extends EnvUser
|
|||
|
||||
protected SecurityMonitor getStaticMonitor()
|
||||
{
|
||||
return getEngine().env_getSecurityMonitor(EngineBackend.SM_COMMUNITY);
|
||||
return sm;
|
||||
|
||||
} // end getStaticMonitor
|
||||
|
||||
|
@ -116,7 +119,6 @@ public class EnvCommunity extends EnvUser
|
|||
|
||||
public boolean testPermission(String symbol, String errormsg) throws AccessError
|
||||
{
|
||||
SecurityMonitor sm = getStaticMonitor();
|
||||
if ( symbol.equals(PERM_READ) || symbol.equals(PERM_WRITE) || symbol.equals(PERM_CREATE)
|
||||
|| symbol.equals(PERM_DELETE) || symbol.equals(PERM_JOIN))
|
||||
{ // fall back to the backend object to test this
|
||||
|
@ -136,7 +138,6 @@ public class EnvCommunity extends EnvUser
|
|||
|
||||
public boolean testPermission(String symbol)
|
||||
{
|
||||
SecurityMonitor sm = getStaticMonitor();
|
||||
if ( symbol.equals(PERM_READ) || symbol.equals(PERM_WRITE) || symbol.equals(PERM_CREATE)
|
||||
|| symbol.equals(PERM_DELETE) || symbol.equals(PERM_JOIN))
|
||||
return comm.env_testPermission(symbol);
|
||||
|
@ -165,7 +166,7 @@ public class EnvCommunity extends EnvUser
|
|||
|
||||
public final boolean isLevelAdmin(int level)
|
||||
{
|
||||
return getStaticMonitor().testPermission(PERM_SHOWADMIN,level);
|
||||
return sm.testPermission(PERM_SHOWADMIN,level);
|
||||
|
||||
} // end isLevelAdmin
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ public class EnvConference extends EnvCommunity
|
|||
*/
|
||||
|
||||
private ConferenceBackend conf;
|
||||
private SecurityMonitor sm;
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructors
|
||||
|
@ -43,6 +44,7 @@ public class EnvConference extends EnvCommunity
|
|||
{
|
||||
super(parent);
|
||||
this.conf = conf;
|
||||
this.sm = getEngine().env_getSecurityMonitor(EngineBackend.SM_CONFERENCE);
|
||||
|
||||
} // end constructor
|
||||
|
||||
|
@ -50,6 +52,7 @@ public class EnvConference extends EnvCommunity
|
|||
{
|
||||
super(other);
|
||||
this.conf = other.conf;
|
||||
this.sm = other.sm;
|
||||
|
||||
} // end constructor
|
||||
|
||||
|
@ -60,7 +63,7 @@ public class EnvConference extends EnvCommunity
|
|||
|
||||
protected SecurityMonitor getStaticMonitor()
|
||||
{
|
||||
return getEngine().env_getSecurityMonitor(EngineBackend.SM_CONFERENCE);
|
||||
return sm;
|
||||
|
||||
} // end getStaticMonitor
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.apache.log4j.*;
|
|||
import com.silverwrist.venice.except.AccessError;
|
||||
import com.silverwrist.venice.security.AuditRecord;
|
||||
import com.silverwrist.venice.security.Role;
|
||||
import com.silverwrist.venice.security.SecurityMonitor;
|
||||
|
||||
public class EnvUser extends EnvEngine
|
||||
{
|
||||
|
@ -48,6 +49,7 @@ public class EnvUser extends EnvEngine
|
|||
*/
|
||||
|
||||
private UserBackend user; // the user backend object
|
||||
private SecurityMonitor sm; // security monitor at this level
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Constructors
|
||||
|
@ -58,6 +60,7 @@ public class EnvUser extends EnvEngine
|
|||
{
|
||||
super(parent);
|
||||
this.user = user;
|
||||
this.sm = getEngine().env_getSecurityMonitor(EngineBackend.SM_GLOBAL);
|
||||
|
||||
} // end constructor
|
||||
|
||||
|
@ -65,9 +68,21 @@ public class EnvUser extends EnvEngine
|
|||
{
|
||||
super(other);
|
||||
this.user = other.user;
|
||||
this.sm = other.sm;
|
||||
|
||||
} // end constructor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* Overrides from class EnvEngine
|
||||
*--------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected SecurityMonitor getStaticMonitor()
|
||||
{
|
||||
return sm;
|
||||
|
||||
} // end getStaticMonitor
|
||||
|
||||
/*--------------------------------------------------------------------------------
|
||||
* External operations
|
||||
*--------------------------------------------------------------------------------
|
||||
|
@ -117,7 +132,7 @@ public class EnvUser extends EnvEngine
|
|||
|
||||
} // end if
|
||||
|
||||
return getStaticMonitor().testPermission(symbol,user.realBaseLevel(),errormsg);
|
||||
return sm.testPermission(symbol,user.realBaseLevel(),errormsg);
|
||||
|
||||
} // end testPermission
|
||||
|
||||
|
@ -130,7 +145,7 @@ public class EnvUser extends EnvEngine
|
|||
|
||||
} // end if
|
||||
|
||||
return getStaticMonitor().testPermission(symbol,user.realBaseLevel());
|
||||
return sm.testPermission(symbol,user.realBaseLevel());
|
||||
|
||||
} // end testPermission
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user