/** * @author Bogdan Sliptsov * <p>This method returns true if user is a group-creator and has rights to modify group and * returns false if user doesn't have admin rights. */ public boolean isCreator(Long groupId, String deviceId) { if (groupId == null) return false; if (StringUtils.isEmpty(deviceId)) return false; Group group = findById(groupId); if (group == null) return false; Device device = devicesDao.read(deviceId); if (device == null) return false; if (!group.getIdCreator().equals(deviceId)) return false; return true; }