|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Teamcenter二次开发ITK源码分享:设置用户的激活状态' ?2 J" Q9 R1 f3 d# G' z
& I8 n8 u' ^ P e$ S) \
; P- @, a6 E! z; z- static void do_it(void)# ]+ |& X+ G( N( g+ [3 }
- {, c- B) u% p" _) t8 H
- int / @/ L# s8 r2 ?- p# r# J
- status = 0,
8 ?( b6 \" G. u9 d - new_status = 0;
: M3 l# Q, n% Q8 Z# d$ x - tag_t
% t) C7 q; o7 L - user = NULLTAG;
# Q$ [& O. D" }/ A5 v7 Q5 i( o& ] - char 5 g8 p% a2 f# P+ K
- user_id[SA_user_size_c+1] = "plmhome",
3 T( }$ @: g& m( N" T - status_string[2][10] = {"active", "inactive"},
4 H; Z5 ]$ ?1 l2 F - person_name[SA_person_name_size_c+1] = "";
, Z, N8 x' M3 k0 a' Z8 i, r
& t. k. ]2 }. }- ITK_CALL(SA_find_user(user_id, &user));5 `* c' [! j# b0 C7 o
- ITK_CALL(AOM_load(user)); c/ Z& q/ X: P5 `0 m6 j; V+ X( P7 ^
- ITK_CALL(SA_ask_user_person_name(user, person_name)); & W& H! v: \' z' }
- ITK_CALL(SA_get_user_status(user, &status));
8 d) T% l! `) ^6 d2 i1 A) w; _) I - ECHO("Person Name: %s - %s\n", person_name, status_string[status]);
% b! a4 J: i" m4 _' N; @ - 5 D, h! U3 l. q: u8 w+ i" r. d! e
- /* reverse it */; Q/ g5 @. P! \# x1 G) D
- if (status == ACTIVE) new_status = INACTIVE;- d& Q7 S7 B& ?+ F3 [
- if (status == INACTIVE) new_status = ACTIVE;9 b! Y# \+ i: O' u, c
- ! f( p" s) N! ~& Q4 _
- ITK_CALL(AOM_lock(user));
$ {, v! @4 M; U S! V - ITK_CALL(SA_set_user_status(user, new_status));6 _% e) q) @' e" H/ W; V- K
- ITK_CALL(AOM_save(user));3 m8 A4 N" n" K6 U) Y* W9 R6 ~0 s3 v
- ITK_CALL(AOM_unlock(user));
, W4 I9 w) H- D1 o) w* V/ e' O- i - ITK_CALL(AOM_unload(user));; @5 t# |; W* O% W/ U b
- }
复制代码
4 \; W+ j3 S: C' P9 c& @( Q
( X) [. k/ A) w+ e j
6 Z* ]7 A% E$ e% V9 k/ w( A. G( ]8 C+ {/ y" i( a5 W( C* E
4 o6 U" ~0 x* ?& e. s
* S9 c3 L' p: \% g: B6 [( F% G6 B; I( L) p9 V# v
/ N+ ]/ c" E2 \' i, s. W) s/ q; t. G( _5 X- ?5 m
& j2 k9 f% Y3 z7 X% | |
|