001/*
002 * (C) Copyright 2006-2014 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Bogdan Stefanescu
018 *     Florent Guillaume
019 */
020package org.nuxeo.ecm.core.api.security;
021
022import java.io.Serializable;
023import java.util.Set;
024
025/**
026 * A user name, and a set of permissions granted/denied.
027 */
028public interface UserEntry extends Serializable {
029
030    String getUserName();
031
032    Set<String> getGrantedPermissions();
033
034    Set<String> getDeniedPermissions();
035
036    /**
037     * Adds a granted permission for this username.
038     *
039     * @since 5.9.4
040     * @param permission the permission
041     */
042    void addPrivilege(String permission);
043
044    /**
045     * Adds a permission for this username.
046     *
047     * @since 5.9.4
048     * @param permission the permission
049     * @param granted whether the permission is granted or denied
050     */
051    void addPrivilege(String permission, boolean granted);
052
053    /**
054     * Adds a permission for this username.
055     *
056     * @deprecated since 5.9.4 readonly is not used
057     */
058    @Deprecated
059    void addPrivilege(String permission, boolean granted, boolean readOnly);
060
061}