Search in sources :

Example 1 with PermissionOracle

use of org.activityinfo.server.command.handler.PermissionOracle in project activityinfo by bedatadriven.

the class ActivityInfoApiBackend method createNewForm.

@Override
public void createNewForm(FormClass formClass) {
    // Check that we have the permission to create in this database
    PermissionOracle permissionOracle = injector.getInstance(PermissionOracle.class);
    permissionOracle.assertDesignPrivileges(formClass, getAuthenticatedUser());
    ((MySqlStorageProvider) getStorage()).createOrUpdateFormSchema(formClass);
}
Also used : PermissionOracle(org.activityinfo.server.command.handler.PermissionOracle) MySqlStorageProvider(org.activityinfo.store.mysql.MySqlStorageProvider)

Example 2 with PermissionOracle

use of org.activityinfo.server.command.handler.PermissionOracle in project activityinfo by bedatadriven.

the class XFormResourceTest method setUp.

@Before
public void setUp() throws IOException {
    objectifyService = ObjectifyService.begin();
    Provider<AuthenticatedUser> authProvider = Providers.of(new AuthenticatedUser("", USER_ID, "jorden@bdd.com"));
    resourceLocator = new ResourceLocatorSyncImpl(injector.getProvider(FormStorageProvider.class), authProvider, new PermissionOracle(injector.getProvider(EntityManager.class)), new BlobAuthorizerStub());
    OdkFormFieldBuilderFactory fieldFactory = new OdkFormFieldBuilderFactory(resourceLocator);
    AuthTokenProvider tokenService = new AuthTokenProvider();
    TestBlobstoreService blobstore = new TestBlobstoreService(injector.getInstance(DeploymentConfiguration.class), injector.getInstance(EntityManager.class));
    TestInstanceIdService idService = new TestInstanceIdService();
    SubmissionArchiver backupService = new SubmissionArchiver(new DeploymentConfiguration(new Properties()));
    formResource = new XFormResources(resourceLocator, authProvider, fieldFactory, tokenService);
    formSubmissionResource = new XFormSubmissionResource(getDispatcherSync(), resourceLocator, tokenService, blobstore, idService, backupService);
}
Also used : PermissionOracle(org.activityinfo.server.command.handler.PermissionOracle) Properties(java.util.Properties) AuthenticatedUser(org.activityinfo.legacy.shared.AuthenticatedUser) EntityManager(javax.persistence.EntityManager) BlobAuthorizerStub(org.activityinfo.store.spi.BlobAuthorizerStub) DeploymentConfiguration(org.activityinfo.server.DeploymentConfiguration) Before(org.junit.Before)

Aggregations

PermissionOracle (org.activityinfo.server.command.handler.PermissionOracle)2 Properties (java.util.Properties)1 EntityManager (javax.persistence.EntityManager)1 AuthenticatedUser (org.activityinfo.legacy.shared.AuthenticatedUser)1 DeploymentConfiguration (org.activityinfo.server.DeploymentConfiguration)1 MySqlStorageProvider (org.activityinfo.store.mysql.MySqlStorageProvider)1 BlobAuthorizerStub (org.activityinfo.store.spi.BlobAuthorizerStub)1 Before (org.junit.Before)1