Example usage for java.security Permissions Permissions

List of usage examples for java.security Permissions Permissions

Introduction

In this page you can find the example usage for java.security Permissions Permissions.

Prototype

public Permissions() 

Source Link

Document

Creates a new Permissions object containing no PermissionCollections.

Usage

From source file:org.jwebsocket.plugins.scripting.Settings.java

/**
 * Gets application security permissions.
 *
 * @param aAppName// ww w  .  j a v  a 2  s  .  co  m
 * @param aAppPath
 * @return
 */
public Permissions getAppPermissions(String aAppName, String aAppPath) {
    if (mCachedAppPermissions.containsKey(aAppName)) {
        return mCachedAppPermissions.get(aAppName);
    }

    Permissions lPerms = new Permissions();
    Permission lPermission;

    // processing global permissions
    for (String lStrPerm : getGlobalSecurityPermissions()) {
        lPermission = Tools.stringToPermission(JWebSocketConfig.expandEnvVarsAndProps(
                lStrPerm.replace("${APP_HOME}", aAppPath).replace("${EXT}", mExtensionsDirectoryPath)));

        if (null != lPermission) {
            lPerms.add(lPermission);
        }
    }

    // processing app permissions
    if (getAppsSecurityPermissions().containsKey(aAppName)) {
        for (String lStrPerm : getAppsSecurityPermissions().get(aAppName)) {
            lPermission = Tools.stringToPermission(JWebSocketConfig.expandEnvVarsAndProps(
                    lStrPerm.replace("${APP_HOME}", aAppPath).replace("${EXT}", mExtensionsDirectoryPath)));

            if (null != lPermission) {
                lPerms.add(lPermission);
            }
        }
    }

    mCachedAppPermissions.put(aAppName, lPerms);
    return lPerms;
}