001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
010 * or http://forgerock.org/license/CDDLv1.0.html.
011 * See the License for the specific language governing permissions
012 * and limitations under the License.
013 *
014 * When distributing Covered Code, include this CDDL HEADER in each
015 * file and include the License file at legal-notices/CDDLv1_0.txt.
016 * If applicable, add the following below this CDDL HEADER, with the
017 * fields enclosed by brackets "[]" replaced with your own identifying
018 * information:
019 *      Portions Copyright [yyyy] [name of copyright owner]
020 *
021 * CDDL HEADER END
022 *
023 *
024 *      Copyright 2008 Sun Microsystems, Inc.
025 */
026package org.opends.server.authorization.dseecompat;
027
028
029/**
030 * Enumeration that represents the type an "userdn" keyword DN can have.
031 * The issues is the syntax allows invalid URLs such as "ldap:///anyone"
032 * and "ldap:///self".  The strategy is to use this class to hold
033 * the type and another class UserDNTypeURL to hold both this type and URL.
034 *
035 * If the URL is an invalid URL, then a dummy URL is saved.
036 * For types such as URL, DN and DNPATTERN, the actual URL is saved and can
037 * be retrieved by the UserDN.evaluate() method when needed. The dummy URL is
038 * ignored in the UserDN.evaluate() method for types such as: ALL, PARENT,
039 * SELF and ANYONE.
040 */
041public enum EnumUserDNType {
042
043        /**
044         * The enumeration type when the "userdn" URL contains only a DN (no
045         * filter or scope) and that DN has no pattern.
046         */
047        DN(0),
048        /**
049         * The enumeration type when the "userdn" URL contains only a DN (no
050         * filter or scope) and that DN has a substring pattern.
051         */
052        DNPATTERN(1),
053        /**
054         * The enumeration type when the "userdn" URL has the value of:
055         *  "ldap:///all".
056         */
057        ALL(2),
058        /**
059         * The enumeration type when the "userdn" URL has the value of:
060         *  "ldap:///parent".
061         */
062        PARENT(3),
063        /**
064         * The enumeration type when the "userdn" URL has the value of:
065         *  "ldap:///self".
066         */
067        SELF(4),
068        /**
069         * The enumeration type when the "userdn" URL has the value of:
070         *  "ldap:///anyone".
071         */
072        ANYONE(5),
073        /**
074         * The enumeration type when the "userdn" URL is contains a DN (suffix),
075         * a scope and a filter.
076         */
077        URL(6);
078
079        /**
080         * Constructor taking an integer value.
081         * @param v Integer value.
082         */
083        EnumUserDNType(int v) {}
084}