當前位置: 首頁>>代碼示例>>Java>>正文


Java IContainerAuthorization類代碼示例

本文整理匯總了Java中org.opendaylight.controller.containermanager.IContainerAuthorization的典型用法代碼示例。如果您正苦於以下問題:Java IContainerAuthorization類的具體用法?Java IContainerAuthorization怎麽用?Java IContainerAuthorization使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IContainerAuthorization類屬於org.opendaylight.controller.containermanager包,在下文中一共展示了IContainerAuthorization類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getContainerPrivilege

import org.opendaylight.controller.containermanager.IContainerAuthorization; //導入依賴的package包/類
/**
 * Returns the access privilege the user has on the specified container
 *
 * @param userName
 *            The user name
 * @param container
 *            The container name. If null, the default container will be assumed
 * @param bundle
 *            The bundle originating the request
 * @return The access privilege the user is granted on the container
 */
public static Privilege getContainerPrivilege(String userName,
        String container, Object bundle) {
    // Derive the target resource
    String resource = (container == null) ? GlobalConstants.DEFAULT.toString() : container;

    // Retrieve the Container Authorization service
    IContainerAuthorization auth = (IContainerAuthorization) ServiceHelper
            .getGlobalInstance(IContainerAuthorization.class, bundle);
    if (auth != null) {
        return auth.getResourcePrivilege(userName, resource);
    }

    /*
     * Container Authorization service not available. We can only derive the
     * access privilege to the default container based on user level
     */
    if (resource.equals(GlobalConstants.DEFAULT.toString())) {
        IUserManager userManager = (IUserManager) ServiceHelper
                .getGlobalInstance(IUserManager.class, bundle);
        if (userManager != null) {
            switch (userManager.getUserLevel(userName)) {
            case NETWORKADMIN:
                return Privilege.WRITE;
            case NETWORKOPERATOR:
                return Privilege.READ;
            default:
                return Privilege.NONE;
            }
        }
    }

    return Privilege.NONE;
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:45,代碼來源:DaylightWebUtil.java

示例2: configureGlobalInstance

import org.opendaylight.controller.containermanager.IContainerAuthorization; //導入依賴的package包/類
/**
 * Configure the dependency for a given instance Global
 *
 * @param c Component assigned for this instance, this will be
 * what will be used for configuration
 * @param imp implementation to be configured
 * @param containerName container on which the configuration happens
 */
protected void configureGlobalInstance(Component c, Object imp) {
    if (imp.equals(UserManagerImpl.class)) {
        // export the service
        Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
        Set<String> propSet = new HashSet<String>();
        propSet.add("usermanager.localUserSaveConfigEvent");
        propSet.add("usermanager.remoteServerSaveConfigEvent");
        propSet.add("usermanager.authorizationSaveConfigEvent");
        props.put("cachenames", propSet);

        // export the service
        c.setInterface(new String[] { ICacheUpdateAware.class.getName(),
                IUserManager.class.getName(),
                IConfigurationAware.class.getName() }, props);

        c.add(createServiceDependency().setService(
                IClusterGlobalServices.class).setCallbacks(
                "setClusterGlobalService", "unsetClusterGlobalService")
                .setRequired(true));

        c.add(createServiceDependency().setService(IAAAProvider.class)
                .setCallbacks("addAAAProvider", "removeAAAProvider")
                .setRequired(false));

        c.add(createServiceDependency().setService(
                IContainerAuthorization.class).setCallbacks(
                "setContainerAuthClient", "unsetContainerAuthClient")
                .setRequired(false));

        c.add(createServiceDependency().setService(
                IResourceAuthorization.class).setCallbacks(
                "setAppAuthClient", "unsetAppAuthClient")
                .setRequired(false));
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:44,代碼來源:Activator.java

示例3: unsetContainerAuthClient

import org.opendaylight.controller.containermanager.IContainerAuthorization; //導入依賴的package包/類
void unsetContainerAuthClient(IContainerAuthorization s) {
    if (this.containerAuthorizationClient == s) {
        this.containerAuthorizationClient = null;
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:6,代碼來源:UserManagerImpl.java

示例4: setContainerAuthClient

import org.opendaylight.controller.containermanager.IContainerAuthorization; //導入依賴的package包/類
void setContainerAuthClient(IContainerAuthorization s) {
    this.containerAuthorizationClient = s;
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:4,代碼來源:UserManagerImpl.java


注:本文中的org.opendaylight.controller.containermanager.IContainerAuthorization類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。