权限设置-动态视图功能-可解决仅允许弃审自己审核过的单据等权限要求

by 祁宏伟 2011.11.29 16:28

注:脚本执行有风险,对于客户正式环境请在研发指导下执行。

   
 
下面表达式含义:

NewPurchaseOrder.DescFlexField.PubDescSeg1!=OldPurchaseOrder.DescFlexField.PubDescSeg1
 
表示 采购订单的弹性域1 发生改变。 注意Old New 分别表示实体修改前与修改后。

再增加1常见示例:
采购订单 的弹性域字段1 在审核后不允许 更改。
 !(PurchaseOrder.Status.Value==FunEnum('
采购订单状态','已审核',2) and
NewPurchaseOrder.DescFlexField.PubDescSeg1!=OldPurchaseOrder.DescFlexField.PubDescSeg1
)
表示: !(单据状态已经审核 并且 弹性域1发生改变)
就是允许 单据状态已经审核 并且 弹性域1发生改变 之外的情况都是可以的。

 

 

 

   --注:为何用not或!在前面,因为是权限是允许,加了not 里面就成了不允许的条件,动作有很多,如果不是用拒绝的方式,就需要写明确 允许其他动作。

   用户A发料确认后,希望通过权限设置只能A取消发料,其他人不能取消发料。

 not (IssueDoc.HandlePerson.Code!=GetCurrentOperatorCode()  and GetCurrentActionName()=="取消发料")

增加示例:对于库存杂发单: 审核后不可修改单据内容。

   GetCurrentActionName()!="弃审" or  MiscShipment.Status.Value!=FunEnum('库存单据状态','已核准',2)   

2012-09-25: 增加示例: 制单人和审核人不能为同一人,并且只能弃审自己审核的单据
not (
(GetCurrentActionName()=='审核' and PurchaseOrder.CreatedBy==GetCurrentUserName())
or
(GetCurrentActionName()=='弃审' and PurchaseOrder.ApprovedBy!=GetCurrentUserName())
)

一. 获取当前操作动作名称() 与  获取当前操作动作编码()

         对于如:库存杂发单仅允许弃审自己审核过的单据这样的需求,原来无法进行这种设定的主要原因在于:无法确定当前是在做 弃审 操作,还是做修改保存操作。所以问题的复杂度就变成了用之前状态和之后状态等方式去想办法得出当前的操作。

        实际上对于操作早在V2.0就提供了操作日志。写在Action中,所有Action均会进行一次操作记录。

        新的补丁支持了该Action操作放到了Context上下文中。并且在表达式中提供了两个新的公共扩展函数,获取当前操作动作名称() 与  获取当前操作动作编码()

        --注意:获取当前操作动作名称对应的是动作权限中相应的操作动作,一般情况下对应着界面上按扭的显示名称。

  这样,对于上面需求定义就比较简单了,如下所示:

         not((库存杂发单.审核人!= 用户名称) and (当前操作动作名称()=='弃审'))

  其它类似需求自己可以联想。

该实现基本满足了现有的需要。但其仍有可能会存在一点问题:

   1. 当前操作是从UI动作开始传导的。所以,如果用户在操作其它单据的审核或其它操作时,进过层层BP或SV到该实体,其传导会持续,所以,这时候也会得到 这个审核 之类的操作名称 。可能会导致判断不正确。

      -- 这个目前无解,除非在BP,SV层改写上下文,但也不合理。

   2. 其与当前的动作权限一样存在着开发规范的问题。 要求开发人员必须准从规范,所有页面上的事件均必须要通过绑定Action来进行操作。否则会导致 动作权限无法控制 和此处获取不到  当前操作名称 。

       --注意检查有没有在事件中跳过Action的,如果有,会导致无法控制,并且操作不记操作日志。。

 

二。表达式支持在实体修改的情况下,可以取到原始实体和新实体:

   -- 这个在定义权限或者通知管理等 会遇到。在修改的情况下,持久化传给表达式的实体是OrginalData,也就是修改前的实体。 --这个逻辑也可以认为是合理的,如:不允许修改编码为 AAA 的。那此时将编码改成BBB,如果传修改后的实体,取到就是BBB,那就不正确了。   但有些时候,就是需要获取新的值。

 --现在支持:  用 New*** ,如果原实体为: currency 新实体就是 NewCurrency .

判断 币种 编码从 AAA 改成 BBB 可以如下定义表达式:

      currency.Code=='AAA' and NewCurrency.Code='BBB'

 特别注意: 为了保持和老版本兼容。

在通知管理中:     currency  表示的是新的实体 NewCurrency ,     旧的实体用 OldCurrency 。

而在权限管理中: currency表示的是旧实体,新实体用 NewCurrency

-------------下面为2011-10-26所写----

库存杂发单的权限: 仅允许弃审自己审核过的单据。

not(((库存杂发单.审核人 != 用户名称) and (库存杂发单.单据状态 == 枚举("库存单据状态","已核准",2))))

not (MiscShipment.ApprovedBy!=GetCurrentUserName()  and  MiscShipment.Status.Value==FunEnum('库存单据状态','已核准',2))

这种方式漏洞在于,如果单据回写或者其它操作导致对已经审核单据进行变更提交,也会导致报权限非法,而非仅在弃审状况下起作用。

理论上应该用下面方式:但由于校验的时机不是在实体后事件,导致状态,并没有改正过来,也取不取旧状态。

--旧状态可以考虑提供方式来获取。

---下面不可行-----状态值并非当前最新状态,而是数据库中的状态。

2:表示已经审核    0:表示开立 。    2-0 表示弃审操作

not((((库存杂发单.审核人 != 用户名称) and (库存杂发单.之前状态 == 2)) and (库存杂发单.当前状态 == 0)))

not (MiscShipment.ApprovedBy!=GetCurrentUserName()  and  MiscShipment.WFOriginalState==2 and  MiscShipment.WFCurrentState==0)

类似的支持问题: 9201111250112   如何设置A用户审核的单据,只能A用户弃审。

 目前的难点是:无法知道当前是在做弃审操作。

          --U9缺少一个当前操作动作传导的概念。在当初规划LOG功能时,曾提到过要做。同时,现在UI记操作时,也记录当前Action操作。这 考虑放到当前上下文中传递过去??

 

2013-03-12 : 增加一个回写导致的问题。 已经解决 2013-03月UBF补丁。

由于弃审时需要做回写动作,那在用条件 如:(GetCurrentActionName()=="弃审" and Receivement.ApprovedBy=="wsf1128标识1129") or (GetCurrentActionName()!="弃审") 时,因为弃审后,回写的Receivement.ApprovedBy审核人其实已经被改掉了。而当时的操作上下文中CurrentActionName仍然是"弃审",导致权限判断失效。

--解决办法1: 对于回写,将权限关闭。

             2: 权限条件增加对 单据状态判断。

--彻底解决办法: 实体层上对所有增删除改事件中禁止写权限,原理与实体.实体的加载权限去除一样,客户要用的写是针对界面操作,不是后台逻辑和回写等。。。

    应付单设置单据类型01发票02借项通知单03贷项通知单04借项账户单05贷项账户单等等单据类型,现有用户A,要求A能够看到所有单据,但不能修改发票的表体行金额税额等相关列,同时可以增删改02、03、04、05等单据的金额税额等字段。请指导,谢谢!

--可以用增删改权限来处理, 对应付单行设置 增删改权限,其条件 描述如下:
  !( (行。头。单据类型 == 发票) 并且 (行。金额!=New行。金额 || 行。税额!=New行。税额) )
也就是 除了 行.头的单据类型为发票 并且 行的金额或税额发生变化的情况 外 其它均允许保存。

       

评论 (40) -

강남레깅스룸 美国 wrote at 2019/4/14 10:51:36 #

Today, I went to the beach front with my children. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is totally off topic but I had to tell someone!

강남레깅스룸 美国 wrote at 2019/4/14 11:52:10 #

If you wish for to obtain a great deal from this piece of writing then you have to apply these strategies to your won blog.

강남레깅스룸 美国 wrote at 2019/4/14 12:06:53 #

Hi! Would you mind if I share your blog with my zynga group? There's a lot of people that I think would really enjoy your content. Please let me know. Thanks

강남레깅스룸 美国 wrote at 2019/4/14 12:14:47 #

wonderful put up, very informative. I'm wondering why the other experts of this sector do not realize this. You should proceed your writing. I'm confident, you've a great readers' base already!

강남레깅스룸 美国 wrote at 2019/4/15 2:31:46 #

Hello to every body, it's my first pay a quick visit of this webpage; this weblog consists of amazing and really good material designed for readers.

강남레깅스룸 美国 wrote at 2019/4/20 14:47:50 #

Every weekend i used to pay a quick visit this website, because i wish for enjoyment, as this this web page conations really fastidious funny material too.

강남레깅스룸 美国 wrote at 2019/4/21 10:35:14 #

Informative article, just what I wanted to find.

강남레깅스룸 美国 wrote at 2019/4/21 11:06:30 #

What's up, the whole thing is going well here and ofcourse every one is sharing data, that's truly good, keep up writing.

강남레깅스룸 美国 wrote at 2019/6/10 10:52:27 #

Every weekend i used to go to see this site, as i wish for enjoyment, since this this web page conations in fact fastidious funny stuff too.

강남레깅스룸 美国 wrote at 2019/6/11 19:59:05 #

If some one wishes expert view concerning blogging afterward i recommend him/her to pay a quick visit this blog, Keep up the fastidious job.

레깅스룸 美国 wrote at 2019/6/12 3:21:05 #

You're so cool! I don't think I have read a single thing like that before. So nice to find somebody with original thoughts on this topic. Seriously.. thank you for starting this up. This site is something that is needed on the internet, someone with some originality!

강남레깅스룸 美国 wrote at 2019/6/18 8:02:57 #

Good way of explaining, and good paragraph to take facts concerning my presentation subject, which i am going to deliver in university.

scr888 whatsapp 美国 wrote at 2019/6/29 2:26:46 #

There is no better strategy to grow your online business than through Internet article writing. If used correctly, blogs get close to the internet through feeds. To become the writer, Highly knowledgable person can end up being the writer.  Look into my webpage  scr888 whatsapp - vanguard.com.ua/.../1.php

slut amateur young porn teens compilation CupidXXX.net CupidXXX 美国 wrote at 2019/6/30 20:55:34 #

Thanks designed for sharing such a pleasant thinking, post is nice, thats why i have read it entirely

scr8888 for iphone 美国 wrote at 2019/7/11 11:37:53 #

Apps will allow you to replace almost every other gadgets like cameras, iPods, e-readers, therefore. Cancel your subscription to neighborhood library newspaper and view your news on great reader.  Here is my web page ::  scr8888 for iphone - Www.Happy4Thofjulyimage.com/.../

강남레깅스룸 美国 wrote at 2019/7/23 20:29:03 #

I am regular reader, how are you everybody? This paragraph posted at this site is really pleasant.

강남레깅스룸 美国 wrote at 2019/8/17 5:49:57 #

I enjoy reading through an article that will make men and women think. Also, many thanks for permitting me to comment!

강남룸 美国 wrote at 2019/8/18 2:15:35 #

Hi there just wanted to give you a quick heads up. The text in your post seem to be running off the screen in Safari. I'm not sure if this is a format issue or something to do with browser compatibility but I figured I'd post to let you know. The design and style look great though! Hope you get the problem resolved soon. Cheers

레깅스룸 美国 wrote at 2019/8/27 7:46:09 #

Hello, I think your site might be having browser compatibility issues. When I look at your website in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, very good blog!

레깅스룸 美国 wrote at 2019/9/10 3:37:42 #

Quality content is the important to interest the people to visit the web page, that's what this site is providing.

레깅스바 美国 wrote at 2019/9/16 2:55:32 #

I quite like reading an article that will make people think. Also, thanks for allowing for me to comment!

sites.google.com 美国 wrote at 2019/10/20 23:47:00 #

I visited several web pages however the audio quality for audio songs present at this web site is really excellent.  Feel free to surf to my blog - scr888 download apk 2020 ( sites.google.com - https://sites.google.com/view/scr888login2020/home )

레깅스룸 美国 wrote at 2019/10/27 19:31:11 #

This is really interesting, You're a very skilled blogger. I have joined your rss feed and look forward to seeking more of your great post. Also, I've shared your website in my social networks!

강남레깅스룸 美国 wrote at 2019/11/2 16:36:51 #

Do you mind if I quote a few of your posts as long as I provide credit and sources back to your blog? My blog is in the very same area of interest as yours and my visitors would genuinely benefit from a lot of the information you provide here. Please let me know if this alright with you. Many thanks!

강남레깅스룸 美国 wrote at 2019/11/7 20:18:49 #

Great post.

강남레깅스룸 美国 wrote at 2019/11/19 19:47:53 #

My spouse and I stumbled over here coming from a different website and thought I might as well check things out. I like what I see so i am just following you. Look forward to checking out your web page repeatedly.

sex and fuck 美国 wrote at 2019/12/1 15:51:11 #

Thailand sex and fuck medical Thailand sex and fuck medical Thailand medical Thailand sex and fuck medical Thailand medical Thailand sex and fuck medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical Thailand medical

강남룸 美国 wrote at 2019/12/3 18:22:34 #

I every time used to study article in news papers but now as I am a user of internet thus from now I am using net for articles or reviews, thanks to web.

레깅스룸 美国 wrote at 2019/12/4 11:47:23 #

Paragraph writing is also a excitement, if you be familiar with afterward you can write or else it is difficult to write.

강남레깅스룸 美国 wrote at 2019/12/8 13:20:25 #

Hi I am so glad I found your website, I really found you by error, while I was researching on Aol for something else, Anyhow I am here now and would just like to say kudos for a fantastic post and a all round interesting blog (I also love the theme/design), I don’t have time to browse it all at the minute but I have saved it and also added your RSS feeds, so when I have time I will be back to read a great deal more, Please do keep up the excellent work.

레깅스룸 美国 wrote at 2019/12/9 21:10:29 #

Hi there, I enjoy reading all of your article. I wanted to write a little comment to support you.

강남레깅스룸 美国 wrote at 2019/12/16 9:06:06 #

Today, spas give a fantastic way to relieve most from the day-to-day stresses we encounter from the modern lifestyles.  Most soccer players can accomplish the needed body building in 72 hours per week.  Acupressure doesn't take care of needles necessarily, nevertheless it does keep to the same notion of pressure points.

레깅스룸 美国 wrote at 2019/12/16 12:32:02 #

Thank you for the good writeup. It in reality was once a amusement account it. Look advanced to more delivered agreeable from you! By the way, how could we keep in touch?

qq slot wcb100 terbaru 2019 美国 wrote at 2019/12/28 3:08:30 #

Keep on writing, great job!

judi slot Promo new member 100 美国 wrote at 2020/1/1 1:26:05 #

I have read several just right stuff here. Certainly worth bookmarking for revisiting. I surprise how so much effort you set to make such a excellent informative web site.

agen slot Bonus besar 美国 wrote at 2020/1/10 15:49:19 #

Pretty nice post. I just stumbled upon your blog and wished to say that I have truly enjoyed browsing your blog posts. In any case I'll be subscribing to your feed and I hope you write again soon!

Idn33.Com 美国 wrote at 2020/1/14 8:08:05 #

Excellent blog here! Additionally your site lots up very fast! What host are you using? Can I am getting your affiliate hyperlink to your host? I want my website loaded up as fast as yours lol

private.sectors.arakistan.cf 美国 wrote at 2020/1/16 23:09:29 #

I really like your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz respond as I'm looking to construct my own blog and would like to know where u got this from. thank you

Qq slot freebet terbaru 2020 美国 wrote at 2020/1/21 12:09:28 #

Hello to all, how is all, I think every one is getting more from this web site, and your views are good for new visitors.

situs judi qq slot Online Terpercaya 美国 wrote at 2020/1/26 22:23:27 #

of course like your web site but you need to take a look at the spelling on quite a few of your posts. Many of them are rife with spelling problems and I in finding it very bothersome to tell the truth then again I will certainly come back again.

添加评论



biuquote
微笑得意调皮害羞酷大笑惊讶发呆喜欢可怜尴尬闭嘴噘嘴皱眉伤心抓狂呕吐坏笑漫骂发怒
Loading


RecentComments

评论 RSS

Statistics

989 篇文章
0 个单页
652926 条评论
11 次评分
248921 次访问
访问统计开始于 2019年12月15日
平均日访问 5531 次
当前 106 人在线