RoleAccess { public static boolean canChangeOwner(AbstractComponent component, User runtimeUser) { for (AbstractComponent bootstrap : PlatformAccess.getPlatform().getBootstrapComponents()) { if (bootstrap.getComponentId().equals(component.getComponentId())) { return false; } } String componentOwner = component.getOriginalOwner() == null ? component.getOwner() : component.getOriginalOwner(); if (componentOwner.equals(runtimeUser.getUserId()) || "admin".equals(runtimeUser.getUserId())) { return true; } else { return RoleAccess.hasRole(runtimeUser, componentOwner); } }  void addRoleService(RoleService roleService); static boolean hasRole(User user, String role); static boolean canChangeOwner(AbstractComponent component, User runtimeUser); static String getPrimaryRole(User user); static String[] getAllRoles(); static String[] getAllRoles(String user); static String[] getAllUsers(); static void releaseRoleServices(); void removeRoleService(RoleService roleService);  }
@Test(dataProvider="userAndComponentSetup") public void testCanChangeOwner(String userName, String originalOwner, String id, boolean expectedValue) { setupUserAndComponent(userName, originalOwner, id); component.setOwner(userName); Assert.assertEquals(RoleAccess.canChangeOwner(component, testUser), expectedValue); }