    001/*
    002    Licensed to the Apache Software Foundation (ASF) under one
    003    or more contributor license agreements.  See the NOTICE file
    004    distributed with this work for additional information
    005    regarding copyright ownership.  The ASF licenses this file
    006    to you under the Apache License, Version 2.0 (the
    007    "License"); you may not use this file except in compliance
    008    with the License.  You may obtain a copy of the License at
    009
    010       http://www.apache.org/licenses/LICENSE-2.0
    011
    012    Unless required by applicable law or agreed to in writing,
    013    software distributed under the License is distributed on an
    014    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    015    KIND, either express or implied.  See the License for the
    016    specific language governing permissions and limitations
    017    under the License.
    018 */
    019package org.apache.wiki.auth.acl;
    020
    021import java.security.Principal;
    022import java.util.Collections;
    023import java.util.Enumeration;
    024import java.util.List;
    025import java.util.stream.Collectors;
    026
    027
    028/**
    029 * <p>
    030 * Deprecated, interface kept in order to keep backwards compatibility with versions up to 2.11.0.M6. {@link org.apache.wiki.api.core.Acl}
    031 * should be used instead.
    032 * </p>
    033 * {@inheritDoc}
    034 * @since 2.3
    035 * @deprecated use {@link org.apache.wiki.api.core.Acl} instead
    036 * @see org.apache.wiki.api.core.Acl
    037 */
    038@Deprecated
    039public interface Acl extends org.apache.wiki.api.core.Acl {
    040
    041    /**
    042     * Adds an ACL entry to this ACL. An entry associates a principal (e.g., an individual or a group) with a set of permissions. Each
    043     * principal can have at most one positive ACL entry, specifying permissions to be granted to the principal. If there is already an
    044     * ACL entry already in the ACL, false is returned.
    045     *
    046     * @param entry - the ACL entry to be added to this ACL
    047     * @return true on success, false if an entry of the same type (positive or negative) for the same principal is already present in this ACL
    048     * @deprecated use {@link #addEntry(org.apache.wiki.api.core.AclEntry)} instead.
    049     * @see #addEntry(org.apache.wiki.api.core.AclEntry
    050     */
    051    @Deprecated
    052    default boolean addEntry( final AclEntry entry ) {
    053        return addEntry( ( org.apache.wiki.api.core.AclEntry )entry );
    054    }
    055
    056    /**
    057     * Returns an enumeration of the entries in this ACL. Each element in the enumeration is of type AclEntry.
    058     *
    059     * @return an enumeration of the entries in this ACL.
    060     * @deprecated use {@link #aclEntries()} instead.
    061     * @see #aclEntries()
    062     */
    063    @Deprecated
    064    default Enumeration< AclEntry > entries() {
    065        final List< AclEntry> entries = Collections.list( aclEntries() ) // iterates list two times - this is ok as we don't expect too many elements inside aclEntries()
    066                                                   .stream()
    067                                                   .map( entry -> ( AclEntry )entry )
    068                                                   .collect( Collectors.toList() );
    069        return Collections.enumeration( entries );
    070    }
    071
    072    /**
    073     * Returns an AclEntry for a supplied Principal, or <code>null</code> if the Principal does not have a matching AclEntry.
    074     *
    075     * @param principal the principal to search for
    076     * @return the AclEntry associated with the principal, or <code>null</code>
    077     * @deprecated use {@link #getAclEntry(Principal)} instead.
    078     * @see #getAclEntry(Principal)
    079     */
    080    @Deprecated
    081    default AclEntry getEntry( final Principal principal ) {
    082        return ( AclEntry )getAclEntry( principal );
    083    }
    084
    085    /**
    086     * Removes an ACL entry from this ACL.
    087     *
    088     * @param entry the ACL entry to be removed from this ACL
    089     * @return true on success, false if the entry is not part of this ACL
    090     * @deprecated use {@link #removeEntry(org.apache.wiki.api.core.AclEntry)} instead.
    091     * @see #removeEntry(org.apache.wiki.api.core.AclEntry
    092     */
    093    @Deprecated
    094    default boolean removeEntry( final AclEntry entry ) {
    095        return removeEntry( ( org.apache.wiki.api.core.AclEntry )entry );
    096    }
    097
    098}