[New] Added privilege checking for StrolchQueries

This commit is contained in:
Robert von Burg 2014-09-08 13:35:57 +02:00
parent 71973e8597
commit 376278cc25
5 changed files with 14 additions and 4 deletions

View File

@ -131,7 +131,7 @@ public class PostgreSqlPersistenceHandler extends StrolchComponent implements Pe
@Override @Override
public StrolchTransaction openTx(StrolchRealm realm, Certificate certificate, String action) { public StrolchTransaction openTx(StrolchRealm realm, Certificate certificate, String action) {
return new PostgreSqlStrolchTransaction(realm, certificate, action, this); return new PostgreSqlStrolchTransaction(getContainer().getPrivilegeHandler(), realm, certificate, action, this);
} }
Connection getConnection(String realm) { Connection getConnection(String realm) {

View File

@ -24,6 +24,7 @@ import li.strolch.persistence.api.OrderDao;
import li.strolch.persistence.api.PersistenceHandler; import li.strolch.persistence.api.PersistenceHandler;
import li.strolch.persistence.api.ResourceDao; import li.strolch.persistence.api.ResourceDao;
import li.strolch.persistence.api.TransactionResult; import li.strolch.persistence.api.TransactionResult;
import li.strolch.runtime.privilege.PrivilegeHandler;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -40,9 +41,9 @@ public class PostgreSqlStrolchTransaction extends AbstractTransaction {
private AuditDao auditDao; private AuditDao auditDao;
private Connection connection; private Connection connection;
public PostgreSqlStrolchTransaction(StrolchRealm realm, Certificate certificate, String action, public PostgreSqlStrolchTransaction(PrivilegeHandler privilegeHandler, StrolchRealm realm, Certificate certificate,
PostgreSqlPersistenceHandler persistenceHandler) { String action, PostgreSqlPersistenceHandler persistenceHandler) {
super(realm, certificate, action); super(privilegeHandler, realm, certificate, action);
this.persistenceHandler = persistenceHandler; this.persistenceHandler = persistenceHandler;
} }

View File

@ -31,6 +31,9 @@
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege"> <Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed> <AllAllowed>true</AllAllowed>
</Privilege> </Privilege>
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role> </Role>
</Roles> </Roles>
</UsersAndRoles> </UsersAndRoles>

View File

@ -31,6 +31,9 @@
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege"> <Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed> <AllAllowed>true</AllAllowed>
</Privilege> </Privilege>
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role> </Role>
</Roles> </Roles>
</UsersAndRoles> </UsersAndRoles>

View File

@ -31,6 +31,9 @@
<Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege"> <Privilege name="li.strolch.service.api.Service" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed> <AllAllowed>true</AllAllowed>
</Privilege> </Privilege>
<Privilege name="li.strolch.model.query.StrolchQuery" policy="DefaultPrivilege">
<AllAllowed>true</AllAllowed>
</Privilege>
</Role> </Role>
</Roles> </Roles>
</UsersAndRoles> </UsersAndRoles>