|
On Fri, 3 Nov 2000 Gwecnal@aol.com wrote: > Is there an API for determining if a user profile is a member of a group? > Something simple where I pass the user profile name, group profile name, and > get a yes or no. > TIA, Lance > There isn't anything THIS simple, but you could certainly write a service program, and IT could be this simple to use. :) In fact, here's one that I wrote, along with an example of using it: Example of calling GROUP service program: D/COPY QRPGLESRC,GROUP_H D Msg S 50A c *entry plist c parm UserID 10 c parm Group 10 c if IsInGroup(UserID: Group) = 1 c eval Msg = 'User is in that group!' C else c eval Msg = 'User is not in that group!' c endif c dsply Msg c eval *inlr = *on Start of header file for GROUP service program (GROUP_H): D IsInGroup PR 10I 0 D UsrPrf 10A const D GrpPrf 10A const Start of source for GROUP service program: D/COPY QRPGLESRC,GROUP_H P*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P* IsInGroup( UserProfile : GroupProfile) P* Checks if a user is in a given group profile. P* P* Returns: -1 = Error, 0 = Not In Group, 1 = Is In Group P*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P IsInGroup B export D IsInGroup PI 10I 0 D UsrPrf 10A const D GrpPrf 10A const D RtvUsrPrf PR ExtPgm('QSYRUSRI') D RcvVar 32766A OPTIONS(*VARSIZE) D RcvVarLen 10I 0 const D Format 8A const D UsrPrf 10A const D Error 32766A OPTIONS(*VARSIZE) D dsEC DS D* Bytes Provided (size of struct) D dsECBytesP 1 4B 0 INZ(256) D* Bytes Available (returned by API) D dsECBytesA 5 8B 0 INZ(0) D* Msg ID of Error Msg Returned D dsECMsgID 9 15 D* Reserved D dsECReserv 16 16 D* Msg Data of Error Msg Returned D dsECMsgDta 17 256 D dsRU DS D* Bytes Returned D dsRUBytRtn 10I 0 D* Bytes Available D dsRUBytAvl 10I 0 D* User Profile Name D dsRUUsrPrf 10A D* User Class D dsRUClass 10A D* Special Authorities D dsRUSpcAut 15A D* Group Profile Name D dsRUGrpPrf 10A D* Owner D dsRUOwner 10A D* Group Authority D dsRUGrpAut 10A D* Limit Capabilities D dsRULmtCap 10A D* Group Authority Type D dsRUAutTyp 10A D* (reserved) D dsRUResrv1 3A D* Offset to Supplemental Groups D dsRUoffSG 10I 0 D* Number of Supplemental Groups D dsRUnumSG 10I 0 D* Supplemental Groups D dsRUSupGrp 10A DIM(15) D X S 5I 0 C* Get User Profile c callp RtvUsrPrf( dsRU: %Size(dsRU): 'USRI0200': c UsrPrf: dsEC) C* Check for errors c if dsECBytesA > 0 c return -1 c endif c if dsRUnumSG<0 or dsRUnumSG>15 c return -1 c endif C* In primary group? c if dsRUGrpPrf = GrpPrf c return 1 c endif C* In supplemental group? c do dsRUnumSG X c if dsRUSupGrp(X) = GrpPrf c return 1 c endif c enddo C* Not in group. c return 0 P E +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.