All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.memority.citadel.shared.api.im.ReservedFlag Maven / Gradle / Ivy

Go to download

This artifact provides the API classes that are necessary to implement general configuration Rules on the Memority IM platform.

There is a newer version: 3.43.1
Show newest version
/*
 * Copyright (c) 2016-2023 Memority. All Rights Reserved.
 *
 * This file is part of Memority Citadel API , a Memority project.
 *
 * This file is released under the Memority Public Artifacts End-User License Agreement,
 * see 
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 */
package com.memority.citadel.shared.api.im;

import com.memority.toolkit.core.api.util.JsonEnum;

import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * Caution! Do not change the enum order because we rely on it for internal storage as a bit mask.
 */
public enum ReservedFlag implements JsonEnum {
    BYPASS_DEDUP, BYPASS_INTEGRITY, BYPASS_UNICITY, BYPASS_VALIDATION,
    R04, R05, R06, R07, R08, R09, PASSWORD_GRACE, PASSWORD_EXPIRED, MYMFA_ACCOUNT_MIGRATION, R13, R14, R15;

    /**
     * Reserved flags which actually have a meaning. Do not forget to add enum values when starting to use them
     */
    private static final Set USED_FLAGS =
            Stream.of(BYPASS_DEDUP, BYPASS_INTEGRITY, BYPASS_UNICITY, BYPASS_VALIDATION, PASSWORD_GRACE, PASSWORD_EXPIRED, MYMFA_ACCOUNT_MIGRATION).collect(Collectors.toSet());

    public static boolean isInUsage(ReservedFlag flag) {
        return USED_FLAGS.contains(flag);
    }
    public static boolean areInUsage(Collection flags) {
        return USED_FLAGS.containsAll(flags);
    }
    public static Set getUsedFlags() {
        return Collections.unmodifiableSet(USED_FLAGS);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy