home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / clipper / nettos11.zip / BINDERY / CHGPSEC.PRG < prev    next >
Text File  |  1993-02-23  |  4KB  |  118 lines

  1. /*
  2.  * File......: CHGPSEC.PRG
  3.  * Author....: Kevin Maher/Steve Tyrakowski
  4.  * CIS ID....: 73766,1224
  5.  * Date......: $Date$
  6.  * Revision..: $Revision$
  7.  * Log file..: $Logfile$
  8.  * 
  9.  * This is an original work by Kevin Maher and Steve Tyrakowski
  10.  * and is placed in the public domain.
  11.  *
  12.  * Modification history:
  13.  * ---------------------
  14.  *
  15.  * $Log$
  16.  *
  17.  */
  18.  
  19.  
  20. /*  $DOC$
  21.  *  $FUNCNAME$
  22.  *     FN_cProSec()
  23.  *  $CATEGORY$
  24.  *     Bindery
  25.  *  $ONELINER$
  26.  *     Change Property Security
  27.  *  $SYNTAX$
  28.  *
  29.  *     FN_cBndOse(cObject, nType, cProperty, nWrite, nRead) => lChanged
  30.  *
  31.  *  $ARGUMENTS$
  32.  *
  33.  *
  34.  *     <cObjectName> is the name of the Bindery Object that you are trying
  35.  *             to change the property security for.  Max Length = 47
  36.  *
  37.  *     <nObjectType> is the Bindery Object Type.  Manifest constants
  38.  *             describing the defined types are included in the
  39.  *             NETTO.CH header file.  Wildcard characters are
  40.  *             not allowed.
  41.  *
  42.  *     <cProperty> is the name of the property whose security is to be
  43.  *           changed.  Max Length = 15
  44.  *
  45.  *     <nWrite> is the Property write security as an integer.
  46.  *        The integer indicates who can add properties
  47.  *        to the bindery object.
  48.  *
  49.  *     <nRead> is the Property read security as an integer.
  50.  *           The integer indicates who can read and scan
  51.  *           properties for a bindery object.
  52.  *
  53.  *         ┌─────────────────────────────────┐
  54.  *         │ Read and Write Security Levels  │
  55.  *         ├──┬──────────────────────────────┤
  56.  *         │ 0│ Anyone                       │
  57.  *         ├──┼──────────────────────────────┤
  58.  *         │ 1│ Logged                       │
  59.  *         ├──┼──────────────────────────────┤
  60.  *         │ 2│ Object                       │
  61.  *         ├──┼──────────────────────────────┤
  62.  *         │ 3│ Supervisor                   │
  63.  *         ├──┼──────────────────────────────┤
  64.  *         │ 4│ Netware Operating System     │
  65.  *         └──┴──────────────────────────────┘
  66.  *
  67.  *
  68.  *  $RETURNS$
  69.  *
  70.  *     <lChanged> logical if security was changed or not.
  71.  *       If an error occurs, .F. will be the return value.
  72.  *
  73.  *  $DESCRIPTION$
  74.  *
  75.  *     This function changes the security of a bindery object's
  76.  *     property.
  77.  *
  78.  *  $SEEALSO$
  79.  *     fn_cBndOSe()
  80.  *  $EXAMPLES$
  81.  *
  82.  *     // this will changes KEVIN's IDENTIFICATION property security
  83.  *     // to SUPERVISOR to change and LOGGED to read
  84.  *     lChanged := FN_cProSec("KEVIN", OT_USER, "IDENTIFICATION", 3, 1)
  85.  *
  86.  *  $END$
  87.  */
  88.  
  89. #include "ftint86.ch"
  90. #include "netto.ch"
  91.  
  92. #define NW_LOG 227
  93.  
  94. #xcommand DEFAULT <v1> TO <x1> [, <vN> TO <xN> ];
  95.       => IIF((<v1>)=NIL,<v1>:=<x1>,NIL) [; IF((<vN>)=NIL,<vN>:=<xN>,NIL)]
  96.  
  97. #ifdef FT_TEST
  98.   FUNCTION MAIN(cObject, nType, cProperty, nWrite, nRead)
  99.     IF FN_cProSec(cObject, Val(nType), cProperty, Val(nWrite), Val(nRead))
  100.       Qout("Property security was successfully changed.")
  101.     ELSE
  102.       Qout("Property security was not changed.")
  103.     ENDIF
  104.   RETURN ( nil )
  105. #endif
  106.  
  107. FUNCTION FN_cProSec(cObject, nType, cProperty, nWrite, nRead )
  108.  
  109.   LOCAL cSend := I2BYTE(59);              // 3Bh API request code
  110.            + W2HILO(nType);                 // nw_int Object type
  111.            + FN_NameL(cObject,48);          // Owner Name
  112.            + I2BYTE((nWrite * 16) + nRead); // Security level
  113.            + FN_NameL(Upper(cProperty),16)  // Property name
  114.  
  115.   // See  crtprop.prg for Upper(cProperty) discussion
  116.  
  117. RETURN _fnReq(NW_LOG,cSend,"") == ESUCCESS
  118.