Re: Limit input into alpha characters into variable
Hi Many thanks for those answers. Whilst I'll be using a workaround, I've also logged a feature request. http://forums.4d.fr/Post/EN/19424825/1/19424826#19424826 Best regards Keith White Synergist Express Ltd, UK. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Schemes for record level access control
Like I said, many developers don't like 4D access system, in fact, any 4D inbuilt-tools such as QR editor, Query Editor, Label Editor, Sequence Number, Triggers etc. I'm weird and kept using them intensively even after developing on 4D for 27 years. I'm happily remained to be amature:-) Alan Chan 4D iNug Technical <4d_tech@lists.4d.com> writes: >Much like others have indicated, stay as far away as you can from the built in >4D access shit, it's for amatures. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: How to detect EOL character in text file
Replace String($text;lf;cr) -> all lf becomes cr including crlf becoming crcr Replace string($text;crlf;cr) -> none would be found That's why you need to run Replace String($text;crlf;cr) first. Alan Chan 4D iNug Technical <4d_tech@lists.4d.com> writes: >That should have read replace string of course >if you change all the possible EOL characters to CR, then position will >find all the CRs >or have I missed something? >pm > >On Sat, May 13, 2017 at 8:30 PM, James Crate via 4D_Tech < >4d_tech@lists.4d.com> wrote: > >> On May 13, 2017, at 8:53 AM, Peter Mew via 4D_Tech <4d_tech@lists.4d.com> >> wrote: >> > >> > Replace text($text;lf;cr) >> > Replace text($text;crlf;cr) >> > Position($text;cr) >> > -pm >> >> This won’t detect the line endings, which is what was asked, it will >> change them to CR. However, to properly normalize line endings you need to >> replace CRLF first. >> >> Jim Crate > ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Schemes for record level access control
Hi Jorg, Thanks much for taking the time to share. The immediate situation I'm trying to work with isn't as formally hierarchical as your example plus I need to exclude 'restricted' data from even Read Only. I'm managing the table & field access separately. ie. permission to even see a given table is restricted by one's user group. Same idea is applied to fields within the table. The mechanism is very similar to the one you illustrate. What I'm honing now is how to identify specific records that may or may not be accessible and efficiently manage them. Your experience is confirming my initial take. On Fri, May 12, 2017 at 5:51 PM, Jörg Knebel via 4D_Tech < 4d_tech@lists.4d.com> wrote: > G’day Kirk, > > > On 13 May 2017, at 05:42 AEST, Kirk Brooks via 4D_Tech < > 4d_tech@lists.4d.com> wrote: > > > > I'd like to hear from some of you who have implemented systems that allow > > for record-level access control in a 4D database. > > Pick me! ;-) > > You’re sure you want to discuss this on the list down to the last detail? > > Here are some important starting points: > > First, forget everything about putting users in groups the 4D-way, > actually forget/don’t touch the 4D-Access implementation at all. > > Now think of access strictly in to ways: Read Only and Read/Write. > > Imagine an organisation structure 5 level deep (relation arrows like in > 4D): > > Organisation <—— Branch <—— Department <—— Unit <—— User (have a table for > each and you can build your application to be a multi-tenant one) > > Define access levels and apply for RO and RW (2D array LongInt): > > Full access (Designer) FA > Org access OA > Branch access BA > Department access DA > Unit access UA > Author/User access AA > NO access NA > > apply these levels to a spread sheet with columns like this: > > 4dTable name/# RO_FA RO_OA … —> … RW_AA RW_NA > > > - Keep this matrix for each and every user. > > At log in time assign the relevant information to interprocess variables > or to an object. > > have the following LongInt reference fields in EVERY table > > UserCreated > UnitCreated > DepartmentCreated > BranchCreated > OrgCreated > > Every time someone likes to access the content of a table one has to check > the access rights like this > > (code snippet sample) > > Case of > : ($vlAccess=0) //No Access > > If ($vlStatusField>0) > QUERY($TablePtr->; & ;Field($TableNo;$vlStatusField)->=-9) > End if > $0:=2 > : ($vlAccess=1) //Author Access > > If ($vbWholeTable) //all non deleted records in table > If ($vlCreatorField>0) > QUERY($TablePtr->;Field($TableNo;$vlCreatorField)->=<>vlUserID;*) > If ($vlDepartmentField>0) > QUERY($TablePtr->; & ;Field($TableNo;$vlDepartmentField)->=<> > vlUserDepartment;*) > End if > If ($vlBranchField>0) > QUERY($TablePtr->; & ;Field($TableNo;$vlBranchField)->=<>vlUserBranch;*) > End if > If ($vlUnitField>0) > QUERY($TablePtr->; & ;Field($TableNo;$vlUnitField)->=<>vlUserUnit;*) > End if > If ($vlStatusField>0) > QUERY($TablePtr->; & ;Field($TableNo;$vlStatusField)->=1) > Else > QUERY($TablePtr->) > End if > $vbAccess:=True > Else > $0:=2 > End if > Else // in the current selection only > If ($vlCreatorField>0) > QUERY SELECTION($TablePtr->;Field($TableNo;$vlCreatorField)->=<> > vlUserID;*) > If ($vlDepartmentField>0) > QUERY SELECTION($TablePtr->; & ;Field($TableNo;$vlDepartmentField)->=<> > vlUserDepartment;*) > End if > If ($vlBranchField>0) > QUERY SELECTION($TablePtr->; & ;Field($TableNo;$vlBranchField)->=<> > vlUserBranch;*) > End if > If ($vlUnitField>0) > QUERY SELECTION($TablePtr->; & ;Field($TableNo;$vlUnitField)- > >=<>vlUserUnit) > Else > QUERY SELECTION($TablePtr->) > End if > $vbAccess:=True > Else > $0:=2 > End if > End if > end case > > > This is all I have time for, but I hope that helps. > > Cheers > Jörg > > > > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** > -- Kirk Brooks San Francisco, CA === *The only thing necessary for the triumph of evil is for good men to do nothing.* *- Edmund Burke* ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Schemes for record level access control
David, Thanks for throwing this in. It really does make more sense to use a longint even if it is (currently) only a binary choice. On Fri, May 12, 2017 at 6:03 PM, David Adams via 4D_Tech < 4d_tech@lists.4d.com> wrote: > Just as a simple point, it's nice to have access values as a number: > > 1 2 3 4 5 > -- Kirk Brooks San Francisco, CA === *The only thing necessary for the triumph of evil is for good men to do nothing.* *- Edmund Burke* ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: ON ERR CALL: Comments & Seeking Comments
Great tip! I’ll check it out for sure. Sannyasin Siddhanathaswami On May 14, 2017, 7:07 PM -1000, wrote: Seriously though, if you want a chance to develop more consistent and coherent code, you can't doo better than to read (or re-read) "Code Complete." (There's a second edition now, for those that don't know.) Best. Coding. Book. Ever. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Option drag and drop vs Sierra
Anyone running OS X Sierra, pleas test in the Method Editor. For me Option drag and drop does not work. Tried it in v14 and v16. Anyone know if this is already a reported bug? John ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Option drag and drop vs Sierra
I just tried in v16.1 with Sierra 10.12.4. Options dragging some text around in the method editor copied the text to the new position just as I would expect. Regular drag and drop within the method editor also worked. FWIW. -- Cannon.Smith Synergy Farm Solutions Inc. Hill Spring, AB Canada 403-626-3236 > On May 15, 2017, at 2:20 PM, John Baughman via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Anyone running OS X Sierra, pleas test in the Method Editor. For me Option > drag and drop does not work. Tried it in v14 and v16. > > Anyone know if this is already a reported bug? > ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Option drag and drop vs Sierra
Hmmm. I am using 16.1 and Sierra 10.12.4, but option dragging moves the selected text. The cursor does not change to a plus symbol either. A long time ago I had this same problem in 4D when I had Quicken set to automatically download from my bank. Turned the Quicken auto download off and 4D option drag worked as advertissed. Quicken is not on this machine, so not sure what is going on. Just tried it 64 bit and see the same problem. John > On May 15, 2017, at 10:27 AM, Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > I just tried in v16.1 with Sierra 10.12.4. Options dragging some text around > in the method editor copied the text to the new position just as I would > expect. Regular drag and drop within the method editor also worked. FWIW. > > -- > Cannon.Smith > Synergy Farm Solutions Inc. > Hill Spring, AB Canada > 403-626-3236 > > > > >> On May 15, 2017, at 2:20 PM, John Baughman via 4D_Tech >> <4d_tech@lists.4d.com> wrote: >> >> Anyone running OS X Sierra, pleas test in the Method Editor. For me Option >> drag and drop does not work. Tried it in v14 and v16. >> >> Anyone know if this is already a reported bug? >> > > ** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ** ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Schemes for record level access control
Hi Kirk, > On 16 May 2017, at 24:59 AEST, Kirk Brooks via 4D_Tech <4d_tech@lists.4d.com> > wrote: > > Thanks much for taking the time to share. The immediate situation I'm > trying to work with isn't as formally hierarchical as your example plus I > need to exclude 'restricted' data from even Read Only. I'm managing the > table & field access separately. ie. permission to even see a given table > is restricted by one's user group. Same idea is applied to fields within > the table. The mechanism is very similar to the one you illustrate. > > What I'm honing now is how to identify specific records that may or may not > be accessible and efficiently manage them. Your experience is confirming my > initial take. For the restrictions to a complete record in a table introduce a LongInt field to every table. I call mine always “xStatus” and if it is set to “1” then it will be interpreted as "not deleted” record. So, LongInt gives you a couple of numbers you can use to define the status of a record. ;-) As for specific field restrictions use a table called [xFieldInfo] and hold the parameters for every field in every table in it. Of the fop of my head, use a LongInt field “AccessLevel” in [xFieldInfo] and think about how Unix handles ownership/access rights: UserGroup Other READ 4 4 4 Write2 2 2 EXECUTE 1 1 1 With "chmod 777” you’ll give everyone everything. Nice idea actually I might implement something like this myself, but not that early, on an empty stomach and with no caffein in the system. ;-) Cheers Jörg ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Re: Schemes for record level access control
On Mon, May 15, 2017 at 8:01 AM, Kirk Brooks via 4D_Tech < 4d_tech@lists.4d.com> wrote: > David, > Thanks for throwing this in. It really does make more sense to use a > longint even if it is (currently) only a binary choice. > Kirk: If you're using a number to represent a hierarchy, the surest way to think of another category "after the code is done" is to use 1, 2, 3, 4, 5, etc. as integers. Prior experience with Murphy would make me lean toward 10, 20, 30, 40, 50 so as to allow 15, 17, 38, etc. -- Douglas von Roeder 949-336-2902 ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Controlling the Menus when executing the EDIT ACCESS command
I’m having some difficulties with menu management when converting from version 13 or 15 to version 16. My problem is that in version 16 when I execute the EDIT ACCESS command I am presented with the Design Menu. In earlier versions I am able to manage the menu’s and when I execute the EDIT ACCESS command the menu displayed is the menu I set prior to executing the EDIT ACCESS command. In version 16 it replaces my menu with the Design Menu. Most features in the Design Menu are not executable (if dimmed or not). I’ve not seen any comments indicating others are having this issue so I recreated a simple database with one method and one form and was able to replicate the problem. Any suggestions on how to keep the Design Menu from showing up when executing the EDIT ACCESS command would be appreciated. -- View this message in context: http://4d.1045681.n5.nabble.com/Controlling-the-Menus-when-executing-the-EDIT-ACCESS-command-tp5752037.html Sent from the 4D Tech mailing list archive at Nabble.com. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Here's one for the archives: Incompatible argument list error with a compiled component
For those of you following my tedious reports on components, the latest chapter! I've consolidated my two components into one because, well, it's a whole lot easier that way. I'm putting that into a host database where it makes life simpler. Instead of my zillions of methods, you see just a few. But then I compile. And I get this sort of error: The argument list for the method named 'ValueCheck_LongintRange' in the component "MessageHub" is incompatible with the database "MessageHubDemo.4DB" Hmm. No it isn't. I got this error from a few methods, seemingly randomly. I tried: * Rebuilding all of the constants in both systems. * Double-checking all calls. * Various other bits of voodoo. (Retokenize all methods, compile with different options, throw salt over my left shoulder, light a candle to Alan Turing, etc.) * All with constant quit-reopen-recompile-build-quit cycles to be sure nothing weird was hanging around. No dice. Finally, I tried generating a typing file over in the source of the component and...there's an extra parameter. I'm not using that parameter, I'm not declaring that parameter (with all vars typed)...but the Compiler thinks it exists. No idea why. I've declared the phantom parameter and now things work. Weird. A note: You can also get this error for good reason. Like, for example, you've got a bad parameter list in your host! In other words, this is a useful error that may be 100% accurate. But when it isn't look for the weird thing that I noticed. P.S. It would make more sense for the compiler to detect this when compiling the host rather than having it only appear when you try to open the compiled host. P.P.S. It would be better if the compiler would detect bad argument lists (too long, for example) all of the time. This feature request still needs more love: Compiler/Typing Improvements: Detect some runtime errors in advance http://forums.4d.fr/Post/EN/19107688/1/19107689 Even if you don't care, vote for it for the sake of your brothers and sisters who do. We'll owe you one! P.P.P.S. Is it just me, or is there something going on with the compiler? I'm in 16.1 and I keep noticing errors that the compiler isn't finding. Hard to reproduce, but I'm noticing it a lot. The compiler has gotten stricter in recent versions (good!), so I hope I'm imagining something here. ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **
Is it possible to do a search in the file system from 4D
I am thinking that perhaps using Launch External Process there might be a way to search for a file and get back the path to the file if found. I have a method that recursively crawls through a volume or folder to locate a file, but it is relatively slow. It is pasted below. Any ideas to make this more efficient or know how to use LEP to do a file search. Needs to work on both Mac and Windows. Thanks, John //Method: SearchFolderContents_Jut C_TEXT($1;$folderPath;$2;$documentToFind;$0;$pathToDocumentFound) $folderPath:=$1 $documentToFind:=$2 $pathToDocumentFound:="" DOCUMENT LIST($folderPath;$aDocuments) $found:=Count in array($aDocuments;$documentToFind) If ($found>0) $pathToDocumentFound:=$folderPath+$documentToFind End if If ($pathToDocumentFound="") FOLDER LIST($folderPath;$aFolders) For ($i;1;Size of array($aFolders)) $pathToDocumentFound:=SearchFolderContents_Jut ($folderPath+$aFolders{$i}+Folder separator;$documentToFind) If ($pathToDocumentFound#"") $i:=Size of array($aFolders)+10 End if End for End if $0:=$pathToDocumentFound ** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **