Search in sources :

Example 1 with ApiPermissionWrapper

use of com.diboot.iam.annotation.process.ApiPermissionWrapper in project diboot by dibo-software.

the class IamCacheManager method initApiPermissionCache.

/**
 * 初始化
 */
private static synchronized void initApiPermissionCache() {
    StaticMemoryCacheManager cacheManager = getCacheManager();
    if (cacheManager.isUninitializedCache(CACHE_NAME_CONTROLLER_API) == false) {
        return;
    }
    List<ApiPermissionWrapper> permissions = ApiPermissionExtractor.extractAllApiPermissions();
    if (V.notEmpty(permissions)) {
        for (ApiPermissionWrapper wrapper : permissions) {
            if (wrapper.getChildren() != null) {
                for (ApiPermission apiPermission : wrapper.getChildren()) {
                    // 缓存url-permission
                    URL_PERMISSIONCODE_CACHE.put(apiPermission.getApiMethod().toUpperCase() + ":" + apiPermission.getApiUri(), apiPermission.getPermissionCode());
                    // 缓存class-api
                    cacheManager.putCacheObj(CACHE_NAME_CONTROLLER_API, wrapper.getClassName(), wrapper);
                }
            }
        }
    }
}
Also used : StaticMemoryCacheManager(com.diboot.core.cache.StaticMemoryCacheManager) ApiPermission(com.diboot.iam.annotation.process.ApiPermission) ApiPermissionWrapper(com.diboot.iam.annotation.process.ApiPermissionWrapper)

Aggregations

StaticMemoryCacheManager (com.diboot.core.cache.StaticMemoryCacheManager)1 ApiPermission (com.diboot.iam.annotation.process.ApiPermission)1 ApiPermissionWrapper (com.diboot.iam.annotation.process.ApiPermissionWrapper)1