Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- NetLib for Clipper, Version 6.0 - n_b_del( <cobject>, <ntype> ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_B_DEL( <cObject>, <nType> )


Parameters

<cObject>
Name of the object.

<nType>
Object type.


Returns

Logical true if successful, false otherwise. If the function returns 
false, you can call N_ERROR(), which will return the NetWare error 
code.


Description

The specified object (and associated properties) will be removed from 
the bindery.

If the specified object does not exist, or if the current user does not 
have the correct write access level to the object (even if the user 
created the object!), no action is taken.

Note  We strongly recommend that you explicitly delete item 
properties, and unlink and delete set properties before deleting the 
object.

NetWare object types are listed below.

Value         Object type
 1            User
 2            Group
 3            Print queue
 4            File server
 6            Gateway
 7            Print server
38            Remote bridge


Example

// Remove a user from the system
LOCAL aProperties:=aMembers:=aMemProp:=aTypes:={}
LOCAL i, j, k
nUser = 1
nGroup = 2

// Disconnect the object from group.
N_B_UNLINK('NEIL', nUser,    ;
           "GROUPS_I'M_IN",  ;
           'EVERYONE', nGroup)
N_B_UNLINK('EVERYONE', nGroup, ;
           'GROUP_MEMBERS',    ;
           'NEIL', nUser       )
N_B_UNLINK('NEIL', nUser,     ;
           'SECURITY_EQUALS', ;
           'EVERYONE', nGroup )

// Note that there are usually more set 
// properties, some created by NetWare.
// Use N_B_PRSCAN() to find them all.
N_B_PRSCAN('NEIL', nUser, aProperties)
FOR i = 1 TO LEN(aProperties)
   // If it's a set property...
   IF N_B_PRTYPE('NEIL',nUser,aProperties[i])='S'
      // Find the members of the set
      N_B_MEMBERS('NEIL', nUser, aProperties[i], ;
                  @aMembers, @aTypes)
      FOR j = 1 TO LEN(aMembers)
         // Unlink the member from Neil's set
         N_B_UNLINK('NEIL', nUser,        ;
                    aProperties[i],       ;
                    aMembers[j], aTypes[j])
         // Find the member object's set 
         // properties.
         N_B_PRSCAN(aMembers[j], aTypes[j],;
                    @MemProp)
         // Examine each property.
         FOR k = 1 TO LEN(aMemProp)
            // If it is a set property and
            // Neil is a member...
            IF N_B_PRTYPE(aMembers[j], aTypes[j],;
                          aMemProp[k])='S'.AND.  ;
               N_B_ISMEMBER(aMembers[j],         ;
                            aTypes[j],           ;
                            aMemProp[k],         ;
                            'NEIL', nUser)
               // unlink Neil from the set.
               N_B_UNLINK(aMembers[j], aTypes[j],;
                          aMemProp[k],           ;
                          'NEIL', nUser)
         NEXT k
      NEXT j
   ENDIF
   // Delete the property.
   N_B_PRDEL('NEIL', nUser, aProperties[i])
NEXT i

// Now delete the user.
N_B_DEL('NEIL', nUser)



See Also: N_B_MEMBERS() N_B_PRDEL() N_B_PRSCAN() N_B_UNLINK()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson