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);
}
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);
}
Aggregations