001/*
002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *  mhilaire
016 *
017 */
018
019package org.nuxeo.ecm.directory;
020
021import org.nuxeo.common.xmap.annotation.XNode;
022import org.nuxeo.common.xmap.annotation.XNodeList;
023import org.nuxeo.common.xmap.annotation.XObject;
024
025/**
026 * Common permission descriptor for all directory that use security check
027 * 
028 * @since 6.0
029 */
030@XObject(value = "permission")
031public class PermissionDescriptor {
032
033    @XNode("@name")
034    public String name;
035
036    @XNodeList(value = "group", type = String[].class, componentType = String.class)
037    public String[] groups;
038
039    @XNodeList(value = "user", type = String[].class, componentType = String.class)
040    public String[] users;
041
042    public PermissionDescriptor clone() {
043        PermissionDescriptor clone = new PermissionDescriptor();
044        clone.name = name;
045        clone.groups = groups;
046        clone.users = users;
047        return clone;
048    }
049}