![JAR search and dependency download from the Maven repository](/logo.png)
org.osgi.service.useradmin.Role Maven / Gradle / Ivy
/*
* Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.osgi.service.useradmin;
import java.util.Dictionary;
/**
* The base interface for Role
objects managed by the User Admin
* service.
*
*
* This interface exposes the characteristics shared by all Role
* classes: a name, a type, and a set of properties.
*
* Properties represent public information about the Role
object that
* can be read by anyone. Specific {@link UserAdminPermission} objects are
* required to change a Role
object's properties.
*
* Role
object properties are Dictionary
objects. Changes
* to these objects are propagated to the User Admin service and made
* persistent.
*
* Every User Admin service contains a set of predefined Role
objects
* that are always present and cannot be removed. All predefined Role
* objects are of type ROLE
. This version of the
* org.osgi.service.useradmin
package defines a single predefined
* role named "user.anyone", which is inherited by any other role.
* Other predefined roles may be added in the future. Since
* "user.anyone" is a Role
object that has properties
* associated with it that can be read and modified. Access to these properties
* and their use is application specific and is controlled using
* UserAdminPermission
in the same way that properties for other
* Role
objects are.
*
* @version $Revision: 5673 $
*/
public interface Role {
/**
* The name of the predefined role, user.anyone, that all users and groups
* belong to.
* @since 1.1
*/
public static final String USER_ANYONE = "user.anyone";
/**
* The type of a predefined role.
*
*
* The value of ROLE
is 0.
*/
public static final int ROLE = 0;
/**
* The type of a {@link User} role.
*
*
* The value of USER
is 1.
*/
public static final int USER = 1;
/**
* The type of a {@link Group} role.
*
*
* The value of GROUP
is 2.
*/
public static final int GROUP = 2;
/**
* Returns the name of this role.
*
* @return The role's name.
*/
public String getName();
/**
* Returns the type of this role.
*
* @return The role's type.
*/
public int getType();
/**
* Returns a Dictionary
of the (public) properties of this
* Role
object. Any changes to the returned Dictionary
* will change the properties of this Role
object. This will
* cause a UserAdminEvent
object of type
* {@link UserAdminEvent#ROLE_CHANGED} to be broadcast to any
* UserAdminListener
objects.
*
*
* Only objects of type String
may be used as property keys, and
* only objects of type String
or byte[]
may be used
* as property values. Any other types will cause an exception of type
* IllegalArgumentException
to be raised.
*
*
* In order to add, change, or remove a property in the returned
* Dictionary
, a {@link UserAdminPermission} named after the
* property name (or a prefix of it) with action changeProperty
* is required.
*
* @return Dictionary
containing the properties of this
* Role
object.
*/
public Dictionary getProperties();
}