如何在Google App Maker中创建复杂的用户角色 [英] How to create complex user roles in Google App Maker

查看:43
本文介绍了如何在Google App Maker中创建复杂的用户角色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑基于组创建一组权限角色,然后根据这些角色细节过滤它们从数据源中看到的数据,但是我似乎无法如愿以偿.

I am looking at creating a set of permission roles based on groups and then filtering the data they see from the datasources based on those role specifics, but I cannot seem to get it to go forward as I would like.

要获得概念证明,我仅尝试过滤名单数据源并使用以下服务器端脚本:

To get proof of concept I am only trying to filter down a roster datasource and have the following server-side script:

function roleCheckAgents(user)
{
  var userRoles = app.getActiveUserRoles();
  var query = app.models.Agents.newQuery();

  if(userRoles.indexOf(app.roles.testRole) >= 1){
     if(app.models.Agents.getRecords().filter().
       query.filters.strRelatedCompany._equals === "sampleCompany");
     return query.run();
  }

}

该小组本身中有我的和其他一些电子邮件,并列为 testRole .在代理程序"数据源安全性中,我已将负载"作为脚本列出,其中包含: roleCheckAgents(user).

the group itself has mine and a few other emails in it, and is listed as testRole. In the Agents datasource security, I have Load listed as script with: roleCheckAgents(user).

实际上,我想在一个角色内设置多个过滤器,例如 Company ==="sampleCompany"&&网站==="sampleSite"

Realistically, I would like to set multiple filters within one role, e.g. Company === "sampleCompany" && Site === "sampleSite", etc.

任何帮助将不胜感激,因为我目前看不到它如何以我需要/想要的方式发挥作用.

Any help would be greatly appreciated as I currently can't see how this will function the way I need/want.

谢谢!

更新:

我能够使用多个过滤器,但是只能作为数据源的查询脚本.创建的问题是我已经在本节中找到了查询构建器条件,并且只能使用查询构建器或查询脚本.

I was able to get the multiple filters to work, but only as a query script of the datasource. The problem that created is that I already had query builder conditions within the section and you can only have query builder or query script.

查询脚本的工作方式如下:

Query Script works as follows:

var query = app.models.Audits.newQuery();  
if(app.getActiveUserRoles().indexOf(app.roles.Test) > -1)
  {   query.filters.field1._contains = "center";
      query.filters.field2._contains = "status";
      return query.run();}
else
{}

当前的查询构建器项目为:

The current query builder items were:

field1 contains? :searchText OR
field2 contains? :searchText OR
field3 contains? :searchText OR
field4 contains? :searchText OR
field5 contains? :searchText

是否有关于如何将两者作为查询构建器或查询脚本的一部分的想法?

Any thoughts on how to have both as part of either the query builder or the query script?

谢谢.克里斯托弗

推荐答案

为什么在指定每个角色的访问权限(数据源上的安全性选项卡)时不使用模型权限".如果您是GCP超级管理员,则可以创建自定义角色.

Why not to use "Model Permissions" where you specify each role's access (security tab on a datasource). You can create custom roles if you're GCP Super Admin.

这篇关于如何在Google App Maker中创建复杂的用户角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆