PLM之家PLMHome-国产软件践行者

【Aras 二次开发代码】为对象Item设置私有权限

[复制链接]

2018-8-1 13:56:44 2061 0

admin 发表于 2018-8-1 13:56:44 |阅读模式

admin 楼主

2018-8-1 13:56:44

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x
Technique  ! O: c, z/ N7 S7 {: r8 T5 Z4 i( i! [1 |
Use the Item Class Extended Method set to set a new private Permission for an Item.
6 l: v- u# g" T8 YJavaScript  4 x; c) i; s/ G3 z5 L# ?( g
// Set up the Part query
: c( L/ G! T0 y; I$ Q+ Pvar innovator = this.newInnovator();
7 G1 q" N3 H, M- W+ }var qryItem = this.newItem("Part", "get");
2 |5 @9 U$ }* q( g- u* s: V1 {qryItem.setAttribute("select", "id,permission_id"); 7 d! m3 e* ]# T! }. _
qryItem.setProperty("item_number", "123-456%", "like");
( [) M2 c5 W2 `, W* J6 b' c4 S ' X3 {4 ?5 X, I+ J
// Run the query and check for errors
' r7 C' L; A" }var resultItem = qryItem.apply();
9 P  o+ N6 `% G' xif (resultItem.isError()) {
( I% w0 z( d5 m, u  @) ? top.aras.AlertError(resultItem.getErrorDetail());
: h. G- Z) ~2 b0 O  r8 D return;
& I; y0 V+ `% F' R}
* b) w/ {- X( }3 _ - L8 J- L/ b* r: ^, Z$ ~
// Iterate over the Items returned and add the private permissions for each.
: L6 K; c' B- \) P) B  gvar count = resultItem.getItemCount(); " \0 i. @' F8 R
for (i=0; i<count; ++i) {
9 I) ?7 X& I8 k* v. S0 w& v( D" g. u var item = resultItem.getItemByIndex(i);
  f) N- V5 U9 {7 U% s // Start with a blank permission ! e7 _) ~( P; y5 s  s0 _1 x8 M0 A4 i) I
var permItem = item.setPrivatePermission(""); 7 c% x; j) ~8 j: Z1 m  \0 T$ G) F
// To copy from the current permission: permItem = item.setPrivatePermission();
  @; Z5 |2 j. ^& \5 e. {% b // To copy from a named permission: permItem = item.setPrivatePermission("New Part");
( x  T4 Z- \2 o
+ I5 ^6 L( ^5 j1 u1 K. H permItem.setProperty("name", permItem.getID()); + e, f' O% }" G
permItem.setIdentityAccess("Component Engineering", "get", true); ) t  |4 z0 j) T8 c) B0 t! s
permItem.setIdentityAccess("CM", "get", true);
4 F( l! N  y$ f- `- N# l" s) P- _ permItem.setIdentityAccess("CM", "update", true); " O. {5 q, j' c( g* }* V! v; h  r

" }* _7 V- J4 f$ c+ a3 \( T // Grant access to the current user's alias identity
* h3 I+ {% r, N var aliasId = innovator.getUserAliases().split(',')[0];
4 t6 V5 d5 U" R# t3 ` var aliasName = innovator.getItemById("Identity",aliasId).getProperty("name"); 0 f) ~1 I1 D( B$ D
permItem.setIdentityAccess(aliasName, "get", true); $ Z% N- j0 L% R1 {4 A- x6 k4 _

. M2 I9 V7 V+ O- q4 U! v1 M4 F) T item.setAction("edit");
% |0 }6 e3 U' P8 s resultItem = item.apply();
' j' z  z  q- V/ e% r2 e if (resultItem.isError()) { top.aras.AlertError(resultItem.getErrorDetail()); } . n2 _; c) x) J' D0 Q/ O& @5 l
} % N! B  t: V8 y5 v" [) A& ~

. P% A" ?! V+ y9 r2 T6 m
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了