// Path: src/main/java/net/atos/entng/rbs/BookingUtils.java
// public static List<String> getLocalAdminScope(final UserInfos user) {
// 	Map<String, UserInfos.Function> functions = user.getFunctions();
// 	if (functions != null && functions.containsKey(DefaultFunctions.ADMIN_LOCAL)) {
// 		Function adminLocal = functions.get(DefaultFunctions.ADMIN_LOCAL);
// 		if (adminLocal != null) {
// 			return adminLocal.getScope();
// 		}
// 	}
// 
// 	return new ArrayList<String>();
// }


import static net.atos.entng.rbs.BookingUtils.getLocalAdminScope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.entcore.common.user.UserInfos;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
	}

	public Optional<String> getManagers() {
		return Optional.ofNullable(json.getString("managers", null));
	}

	public boolean hasNotOwnerOrSchoolId() {
		return !getOwner().isPresent() || !getSchoolId().isPresent();
	}

	public Optional<JsonArray> getManagersAsJsonArray() {
		Optional<String> managersString = getManagers();
		JsonArray managers = (managersString.isPresent()) ? new JsonArray(managersString.get()) : null;
		return Optional.ofNullable(managers);
	}

	/*
	 * Owner or managers of a resourceType, as well as local administrators of a
	 * resourceType's schoolId, do no need to respect constraints on resources'
	 * delays
	 */
	public boolean canBypassDelaysConstraints(UserInfos user) {
		String owner = getOwner().orElse(null);
		String schoolId = getSchoolId().orElse(null);
		JsonArray managers = getManagersAsJsonArray().orElse(null);

		if (user.getUserId().equals(owner)) {
			return true;
		}

// Path: src/main/java/net/atos/entng/rbs/BookingUtils.java
// public static List<String> getLocalAdminScope(final UserInfos user) {
// 	Map<String, UserInfos.Function> functions = user.getFunctions();
// 	if (functions != null && functions.containsKey(DefaultFunctions.ADMIN_LOCAL)) {
// 		Function adminLocal = functions.get(DefaultFunctions.ADMIN_LOCAL);
// 		if (adminLocal != null) {
// 			return adminLocal.getScope();
// 		}
// 	}
// 
// 	return new ArrayList<String>();
// }


// Path: src/main/java/net/atos/entng/rbs/models/Resource.java
import static net.atos.entng.rbs.BookingUtils.getLocalAdminScope;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.entcore.common.user.UserInfos;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;

	}

	public Optional<String> getManagers() {
		return Optional.ofNullable(json.getString("managers", null));
	}

	public boolean hasNotOwnerOrSchoolId() {
		return !getOwner().isPresent() || !getSchoolId().isPresent();
	}

	public Optional<JsonArray> getManagersAsJsonArray() {
		Optional<String> managersString = getManagers();
		JsonArray managers = (managersString.isPresent()) ? new JsonArray(managersString.get()) : null;
		return Optional.ofNullable(managers);
	}

	/*
	 * Owner or managers of a resourceType, as well as local administrators of a
	 * resourceType's schoolId, do no need to respect constraints on resources'
	 * delays
	 */
	public boolean canBypassDelaysConstraints(UserInfos user) {
		String owner = getOwner().orElse(null);
		String schoolId = getSchoolId().orElse(null);
		JsonArray managers = getManagersAsJsonArray().orElse(null);

		if (user.getUserId().equals(owner)) {
			return true;
		}

		List<String> scope = getLocalAdminScope(user);