ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Object authority

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Object authority

    Does anyone know of an API or technique to check authority of an object in an rpg program? I don't want to call a CL if I don't have to. Thanks!

  • #2
    Re: Object authority

    You can use the QSYCUSRA API. I have never used it but got to know abt it once when I was searching for something else.

    Follow this link for usage details of this API


    Let us know if it works.
    Regards,
    KR

    Comment


    • #3
      Re: Object authority

      PHP Code:
           H dftactgrp( *no )  OPTION(*NODEBUGIOACTGRP('BIGUPDATE')
            *
            * 
      Authorities can check up to 11 10 char fields
            
      *
            * *
      EXCLUDE  Exclude authority. If this value is specifiedno other values can be specified.
            * *
      ALL  All authority.
            * *
      CHANGE  Change authority.
            * *USE  Use 
      authority.
            * *
      AUTLMGT  Authorization list management authorityThis value is only valid if the object
            
      type is *AUTL.
            * *
      OBJALTER  Object alter authority.
            * *
      OBJOPR  Object operational authority.
            * *
      OBJMGT  Object management authority.
            * *
      OBJEXIST  Object existence authority.
            * *
      OBJREF  Object reference authority.
            * *
      READ  Read authority.
            * *
      ADD  Add authority.
            * *
      UPD  Update authority.
            * *
      DLT  Delete authority.
            * *
      EXECUTE  Execute authority.
            *
            * 
      Variable Definition
            
      *
           
      d YesOrNo         s              1
           d Object          s             20
           d Type            s             10
           d Authority       s             10
           d 
      #of             s             10i 0 inz(1)
           
      d level           s             10i 0 inz
           d error           s            256

            
      *
           
      d ApiError        Ds
           d  AeBytPro                     10i 0 Inz
      ( %SizeApiError ))
           
      d  AeBytAvl                     10i 0 Inz
           d  AeMsgId                       7a
           d                                1a
           d  AeMsgDta                    128a

            
      *
            * 
      Program Info
            
      *
           
      d                SDS
           d  
      @PGM                 001    010
           d  
      @PARMS               037    039  0
           d  
      @MSGDTA               91    170
           d  
      @MSGID               171    174
           d  
      @JOB                 244    253
           d  
      @USER                254    263
           d  
      @JOB#                264    269  0
            
      *  -------------------------------------------------------------------
            *  -
            *  -------------------------------------------------------------------
           
      c                   eval       object 'QADBXREF  *LIBL'
           
      c                   eval       type   '*FILE'
           
      c                   eval       authority '*USE'

           
      c                   call      'QSYCUSRA'
           
      c                   parm                    YesOrNo
           c                   parm                    
      @USER
           c                   parm                    object
           c                   parm                    type
           c                   parm                    authority
           c                   parm                    
      #of
           
      c                   parm                    level
           c                   parm                    Apierror

           c                   
      eval      *inlr = *on

      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #4
        Re: Object authority

        I can just check the Apierror field ?

        Comment


        • #5
          Re: Object authority

          nope! it only produces an error if there is lets say a bad file name passed , or library doesnt exits...
          need to look @ yesorno
          All my answers were extracted from the "Big Dummy's Guide to the As400"
          and I take no responsibility for any of them.

          www.code400.com

          Comment


          • #6
            Re: Object authority

            I always try to delete the object. If I can delete it, then I was authorized to use it.

            Comment


            • #7
              Re: Object authority

              hey what a great idea...im gonna implement that here.......
              Ill get back to you on the outcome.

              jamie
              All my answers were extracted from the "Big Dummy's Guide to the As400"
              and I take no responsibility for any of them.

              www.code400.com

              Comment


              • #8
                Re: Object authority

                Thanks Jamief!

                Comment


                • #9
                  Re: Object authority

                  I keep getting CPF9810 error. Library list is fine. Object is in library list.

                  Comment


                  • #10
                    Re: Object authority

                    make sure this is setup correctly

                    c eval object = 'QADBXREF *LIBL'

                    object is 20 *char 1st 10 must be object second 10 the library

                    jamie
                    All my answers were extracted from the "Big Dummy's Guide to the As400"
                    and I take no responsibility for any of them.

                    www.code400.com

                    Comment

                    Working...
                    X