1. Dan Black
  2. PowerBuilder
  3. Wednesday, 20 November 2019 17:45 PM UTC

Hi,

I am adding the concept of confidentiality to a number of items in our app. In datawindow lists, I am attempting to do this by putting a 'Confidential' label, with a white background, over top of the entire row and controlling the visibility of the label. This works fine, but if the row is selected the text underneath the confidential label bleeds through completely. 

I've attached a sample application (PB2017 R3) to illustrate the problem.

Is this expected behaviour? I realize I could set the visibility of everything underneath the confidential label as well (opposite of that of the confidential label), but that seems like it should be unnecessary (I have a large number of datawindows that I'm modifying/maintaining).

I'd appreciate any advice, maybe there are other solutions I can't see?

Thanks,

Dan

Attachments (1)
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 20 November 2019 23:42 PM UTC
  2. PowerBuilder
  3. # 1

I checked your sample app.

To me, this is not "expected behavior" but it still happens. I think the only thing you can do is make the other columns also invisible depending on the value for confidential.

If this is a lot of work, if all covering labels are named the same way, or if they all have the same or similar condition for visibility, you might be able to do something in the constructor of the dw (or when changing the dataobject dynamically from code), check on "confidential in their visibility condition":

- loop through all text objects of the dw and check if there's one in the list for which the visibility condition holds the string "confidential", Get the x position and width of that one.

- for all other columns, check if their x position falls between the previously read "x and x + width" positions. If so, add their visibility condition using Modify().

HIH

 

Comment
  1. Miguel Leeuwe
  2. Wednesday, 20 November 2019 23:51 PM UTC
Forgot to say: my solution would only be a quick fix if all of your dw's are inherited from some common ancestor dw. and there aren't lots of overrides of the constructor events. (though the overrides can be figured out quite easily too).
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Thursday, 21 November 2019 00:32 AM UTC
  2. PowerBuilder
  3. # 2

Hi Dan,

If confidential means "user cannot see" then you could consider using function = dw . SetDetailHeight like this code:

// Event = ue_SetAccessLevel( long al_userAccessLevel )
// This script hides all rows requiring security clearance above <userAccessLevel>
long row

this.SetRedraw(false)
for row = this.RowCount() to 1 step -1
   if al_userAccessLevel < this.object.AdminSecurityLevel[row] then
      // Lack of access => Hide this row
      this.SetDetailHeight(row, row, 0)
   end if
next
this.SetRedraw(true)

NOTE: AutoSizeHeight will override any row height set by SetDetailHeight so watch out for "counterproductive" DataWindow configuration.

NOTE: A couple of performance tricks

  • SetRedraw ensures only one screen paint despite potentially hiding hundreds of rows.
  • Reverse loop from RowCount down to 1 ensures RowCount function is called just once. Same can be done incrementing but less efficient. Incrementing row requires either call RowCount to check after each iteration - or assign to extra local variable.

HTH /Michael

Comment
  1. Dan Black
  2. Thursday, 21 November 2019 18:37 PM UTC
Thanks Miguel and Michael,

Michaels solution is interesting, but part of the functionality is that users should be able to see that there is a confidential item and they may have permission to override it.



I think that Miguel's solution will work nicely going forward. (although this seems like a PowerBuilder bug that I'm having to work around)



Thank you both for your ideas!
  1. Helpful
  1. Michael Kramer
  2. Thursday, 21 November 2019 18:59 PM UTC
Hi Dan, What I have done on occasion as a way to hint there is more info "hiding in the shadows" - I simply set detail height to 10 pbu or so - just enough to see top of each column border but no idea what content actually is displayed.

Whatever you do be careful if user can select or TAB through the DataWindow white-on-white or too-big-to-show may still grab focus and let user (copy + paste) or (multi-row-select + copy + paste) or (export to Excel) or some other "clever" breach of security.



BTW: Putting a rectangle on top may hide "deeper" content better than a label. Then put the label on top of the rectangle. There are many ways to approach a requirement when it comes to the DataWindow. Some suit better than others depending on context.
  1. Helpful
  1. Michael Kramer
  2. Thursday, 21 November 2019 19:01 PM UTC
Maybe at Elevate 2020 I should do a new tips-and-tricks on DataWindows specifically. This year was 16 tips-and-tricks on PowerScript apps more broadly.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.