001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo - initial API and implementation
011 *
012 * $Id$
013 */
014
015package org.nuxeo.runtime.api.login;
016
017import java.security.Permission;
018
019/**
020 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
021 */
022public class SystemLoginPermission extends Permission {
023
024    private static final long serialVersionUID = -2587068684672935213L;
025
026    public SystemLoginPermission() {
027        super("systemLogin");
028    }
029
030    @Override
031    public String getActions() {
032        return "";
033    }
034
035    @Override
036    public boolean implies(Permission permission) {
037        return permission instanceof SystemLoginPermission;
038    }
039
040    // TODO: isn't this the default equals() implementation ?
041    @Override
042    public boolean equals(Object obj) {
043        if (obj == this) {
044            return true;
045        }
046        if (obj == null) {
047            return false;
048        }
049        return obj.getClass() == SystemLoginPermission.class;
050    }
051
052    // TODO: check that this really matches the equals() implementation.
053    @Override
054    public int hashCode() {
055        return System.identityHashCode(this);
056    }
057
058}