0 关注者 · 2 帖子

级联样式表 (CSS) 是一种样式表语言,用于描述以标记语言编写的文档的展示形式。

官方网站

文章 姚 鑫 · 十月 9, 2022 3m read

第十一章 CSP 架构 - Web Application Settings

Special Case: DeepSee

对于使用 DeepSeeWeb 应用程序,它需要访问 %DeepSee 包中的所有类。要使特定应用程序能够使用 DeepSee,请在 %SYS 命名空间中使用以下命令:

Do EnableDeepSee^%SYS.cspServer("/csp/webapp/")

其中 web-app-name 是带有斜杠的 Web 应用程序名称。前面的命令等价于以下命令:

Set ^SYS("Security","CSP","AllowClass","web-app-name","%DeepSee.") = 1
Set ^SYS("Security","CSP","AllowClass","web-app-name","%CSP.UI.Portal.About")=1

其中 web-app-name 是带有尾随冲突的 Web 应用程序的名称。请注意,第一行使用 %DeepSee。有一个尾随句点。

或者,要使所有应用程序都能使用 DeepSee,请使用以下变体:

Do EnableDeepSee^%SYS.cspServer(0)

例如,要启用 /csp/webapp Web 应用程序以使用 DeepSee,请使用以下命令:

Do EnableDeepSee^%SYS.cspServer("/csp/webapp/")

要禁止特定 Web 应用程序使用 DeepSee,请使用以下命令:

Set ^SYS("Security", "CSP", "AllowPrefix", "web-app-name", "%DeepSee.") = 0

编辑 Web 应用程序设置

可以在管理门户的编辑 Web 应用程序页面上创建或修改 如何处理特定 CSP 应用程序的设置,如下所示:

  1. 选择系统 > 安全 > Web 应用程序。

这列出了已配置的 Web 应用程序。类型列将应用程序标识为用户应用程序 (CSP) 或系统应用程序(CSP,系统;Caché 中包含的基于 CSP 的实用程序)。

  1. 选择一个应用程序,单击编辑,然后输入或更改信息。
  2. 完成编辑后,重新启动 Caché 以使新设置生效。

常规选项卡包含指定应用程序基本操作所需信息的字段。

应用程序角色选项卡允许选择在使用应用程序期间为用户分配的角色。您在此处选择的应用程序角色将添加到用户已分配到的角色集中。

匹配角色选项卡允许在使用应用程序期间根据当前角色分配将应用程序用户分配给其他角色。

定义新应用程序

要在 CSP 服务器上定义名为 /myapp 的新 CSP 应用程序,请执行以下步骤:

  1. 在管理门户中,选择系统 > 安全 > Web 应用程序,然后单击创建新的 Web 应用程序。
  2. 输入新应用程序名称的 URL,在本例中为 /myapp,然后单击确定。
  3. 填写任何需要的应用程序属性(大多数是可选的)。 (请参阅应用程序设置部分中的表格。)最重要的是:
  • Enable/Disable Authentication allowed — 连接到应用程序的有效身份验证技术
  • 命名空间 — 运行此应用程序的 Caché命名空间
  • Caché Physical PathCSP 文件的物理位置(如果使用基于 HTML 的开发)
  1. 单击保存。
  2. 单击应用程序角色选项卡以选择在使用应用程序期间为用户分配的角色。这些应用程序角色被添加到用户已经分配到的角色集中。
  3. 单击匹配角色选项卡以在使用应用程序期间根据当前角色分配将应用程序用户分配给其他角色。
0
0 125
文章 Michael Lei · 四月 13, 2022 7m read

image

这篇文章是对我的  iris-globals-graphDB 应用的介绍。
在这篇文章中,我将演示如何在Python Flask Web 框架和PYVIS交互式网络可视化库的帮助下,将图形数据保存和抽取到InterSystems Globals中。

建议

第一步 : 通过使用Python 原生SDK建立与IRIS Globals的链接

 #create and establish connection
  if not self.iris_connection:
         self.iris_connection = irisnative.createConnection("localhost", 1972, "USER", "superuser", "SYS")
                                     
  # Create an iris object
  self.iris_native = irisnative.createIris(self.iris_connection)
  return self.iris_native

 

第二步 : 使用 iris_native.set( ) 功能把数据保存到Globals 里     

#import nodes data from csv file
isdefined = self.iris_native.isDefined("^g1nodes")
if isdefined == 0:
    with open("/opt/irisapp/misc/g1nodes.csv", newline='') as csvfile:

reader = csv.DictReader(csvfile) for row in reader: self.iris_native.set(row["name"], "^g1nodes", row["id"])

#import edges data from csv file isdefined = self.iris_native.isDefined("^g1edges") if isdefined == 0: with open("/opt/irisapp/misc/g1edges.csv", newline='') as csvfile: reader = csv.DictReader(csvfile) counter = 0                 for row in reader: counter = counter + 1 #Save data to globals self.iris_native.set(row["source"]+'-'+row["target"], "^g1edges", counter)  

第三步: 使用iris_native.get() 功能把节点和边缘数据从Globals传递给PYVIS

 #Get nodes data for basic graph    
  def get_g1nodes(self):
        iris = self.get_iris_native()
        leverl1_subscript_iter = iris.iterator("^g1nodes")
        result = []
        # Iterate over all nodes forwards
        for level1_subscript, level1_value in leverl1_subscript_iter:
            #Get data from globals
            val = iris.get("^g1nodes",level1_subscript)
            element = {"id": level1_subscript, "label": val, "shape":"circle"}
            result.append(element)            
        return result

    #Get edges data for basic graph       def get_g1edges(self):         iris = self.get_iris_native()         leverl1_subscript_iter = iris.iterator("^g1edges")         result = []         # Iterate over all nodes forwards         for level1_subscript, level1_value in leverl1_subscript_iter: #Get data from globals             val = iris.get("^g1edges",level1_subscript)             element = {"from": int(val.rpartition('-')[0]), "to": int(val.rpartition('-')[2])}             result.append(element)                     return result

 

Step4: Use PYVIS Javascript to generate graph data

<script type="text/javascript">
    // initialize global variables.
    var edges;
    var nodes;
    var network;
    var container;
    var options, data;
  
    // This method is responsible for drawing the graph, returns the drawn network
    function drawGraph() {
        var container = document.getElementById('mynetwork');
        let node = JSON.parse('{{ nodes | tojson }}');
        let edge = JSON.parse('{{ edges | tojson }}');
     
        // parsing and collecting nodes and edges from the python
        nodes = new vis.DataSet(node);
        edges = new vis.DataSet(edge);

        // adding nodes and edges to the graph         data = {nodes: nodes, edges: edges};

        var options = {           "configure": {                 "enabled": true,                 "filter": [                 "physics","nodes"             ]             },             "nodes": {                 "color": {                   "border": "rgba(233,180,56,1)",                   "background": "rgba(252,175,41,1)",                   "highlight": {                     "border": "rgba(38,137,233,1)",                     "background": "rgba(40,138,255,1)"                   },                   "hover": {                   "border": "rgba(42,127,233,1)",                     "background": "rgba(42,126,255,1)"                 }                 },

                "font": {                   "color": "rgba(255,255,255,1)"                 }               },             "edges": {                 "color": {                     "inherit": true                 },                 "smooth": {                     "enabled": false,                     "type": "continuous"                 }             },             "interaction": {               "dragNodes": true,                 "hideEdgesOnDrag": false,               "hideNodesOnDrag": false,                 "navigationButtons": true,                 "hover": true             },

            "physics": {                 "barnesHut": {                     "avoidOverlap": 0,                   "centralGravity": 0.3,                   "damping": 0.09,                     "gravitationalConstant": -80000,                     "springConstant": 0.001,                     "springLength": 250                 },

                "enabled": true,                 "stabilization": {                     "enabled": true,                     "fit": true,                     "iterations": 1000,                     "onlyDynamicEdges": false,                     "updateInterval": 50                 }             }         }         // if this network requires displaying the configure window,         // put it in its div         options.configure["container"] = document.getElementById("config");         network = new vis.Network(container, data, options);       return network;     }     drawGraph(); </script>

 

第五步: 从app.py 主文件调用上面的代码

#Mian route. (index)
@app.route("/")
def index():
    #Establish connection and import data to globals
    irisglobal = IRISGLOBAL()
    irisglobal.import_g1_nodes_edges()
    irisglobal.import_g2_nodes_edges()

    #getting nodes data from globals     nodes = irisglobal.get_g1nodes()     #getting edges data from globals     edges = irisglobal.get_g1edges()

    #To display graph with configuration     pyvis = True     return render_template('index.html', nodes = nodes,edges=edges,pyvis=pyvis)    

下面是关于此项目的 介绍视频:

<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" scrolling="no" src="//player.bilibili.com/player.html?aid=256588464&bvid=BV1LY411w7MU&cid=718938724&page=1" width="560"></iframe>欢迎大家来我们的 Bilibili主页观看更多视频!


谢谢!

0
0 294