use of com.serotonin.m2m2.module.definitions.permissions.DataPointPermissionDefinition in project ma-core-public by infiniteautomation.
the class ViewDataPointsPermissionTest method init.
@Before
public void init() {
this.runAs = Common.getBean(RunAs.class);
this.service = Common.getBean(DataPointService.class);
// create Role for this test
this.viewDataPointsRole = this.createRole("viewDataPointsRole", DataPointPermissionDefinition.PERMISSION);
this.userAllowed = this.createUser("Jane Doe", "Jane001", "14mJ4n3D03!", "jane.doe@unknown.com", viewDataPointsRole.getRole());
this.userWithoutPermission = this.createUser("John Doe", "John001", "14mJ0hnD03!", "john.doe@unknown.com");
// get the permission def
DataPointPermissionDefinition dpPermDef = Common.getBean(DataPointPermissionDefinition.class);
SystemPermissionService sysPermServ = Common.getBean(SystemPermissionService.class);
this.runAs.runAs(this.runAs.systemSuperadmin(), () -> {
sysPermServ.update(MangoPermission.requireAnyRole(viewDataPointsRole.getRole()), dpPermDef);
});
// create a data point that only superadmin can view
point = (DataPointVO) this.createMockDataPoints(1).get(0);
}
Aggregations