2

The follow code is part of a Java client for the Opensource BIMserver.

JsonBimServerClientFactory factory = new JsonBimServerClientFactory("");
BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("exple@dd.com", "poiuy"));
String randomName = "yu" + new Random().nextLong();

// Create a new project with a random name
SProject project = client.getServiceInterface().addProject(randomName, "ifc2x3tc1");
long poid = project.getOid();
String comment = "";

// This method is an easy way to find a compatible deserializer for the combination of
// the "ifc" file extension and this project. You can also get a specific deserializer
// if you want to.
SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", poid);

// Make sure you change this to a path to a local IFC file
String absolutePathOfFile = servletContext.getRealPath("/") + "resources/images/IFC/stickfile.ifc";

java.nio.file.Path demoIfcFile = Paths.get(absolutePathOfFile);
// Here we actually checkin the IFC file.

Above code works fine for checkin of IFC file if a user is of type "Administrator" but does not working for a user of type "User". So how to checkin an IFC file for a user without admin privilege?

hlg
  • 1,321
  • 13
  • 29
Priya
  • 147
  • 1
  • 1
  • 10

1 Answers1

0

Users of type "User" can not create projects. If you create a project with a user of type "Admin", you have to grant the "User" type user permissions on this project using

client.getServiceInterface().addUserToProject(userOid, projectOid)

The code is likely to fail already at the addProject call. Please confirm with the stacktrace and the error message returned from the service call.

hlg
  • 1,321
  • 13
  • 29