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_unlink( <cowner>, <ntype>, <cproperty>,<cmember>, <ntype> ) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
N_B_UNLINK( <cOwner>, <nType>, <cProperty>,<cMember>, <nType> )


Parameters

<cOwner>
Name of the owner object.

<nType>
Type of the owner object.

<cProperty>
Set property of the owner.

<cMember>
Name of member object to be unlinked.

<nType>
Type of member object.


Description

The member object will be disconnected from the owner object via the 
specified set property. If the objects are not already linked, no 
action is taken.

When removing a user from a group, you must remove the user from the 
group's GROUP_MEMBERS set in addition to removing the group from the 
user's GROUPS_I'M_IN set. The bi-directional disconnection is not 
automatic.

Note  You must have write access to modify a property.

Let's say, for example, that you want to unlink a user object named 
DAVID from the group object EVERYONE. The operation will require two 
steps, the first to unlink EVERYONE from DAVID, and the second to 
unlink DAVID from EVERYONE.

The first step, unlinking EVERYONE from DAVID, severs the connection 
through DAVID's property GROUPS_I'M_IN. The code to do this is:

N_B_UNLINK('DAVID',         ;  // <cOwner>
           1,               ;  // <nType>
           "GROUPS_I'M_IN", ;  // <cProperty>
           'EVERYONE',      ;  // <cMember>
           2                )  // <nType>

The second step, unlinking DAVID from EVERYONE, severs the connection 
through GROUP_MEMBERS, a property of the group object EVERYONE. The 
code to do this is:

N_B_UNLINK('EVERYONE',      ;  // <cOwner>
           2,               ;  // <nType>
           'GROUP_MEMBERS', ;  // <cProperty>
           'DAVID',         ;  // <cMember>
           1                )  // <nType>


Example

// Unlink an object from all groups.
PROCEDURE UnlinkSets( cObject, nType )
   LOCAL aObjProp := aMem := aMemType := aMemProp := {}
   LOCAL i, j, k
   // Get the properties of the object.
   N_B_PRSCAN(cObject, nType, @aObjProp)
   // Examine each property.
   FOR i = 1 TO LEN(aObjProp)
      // If it's a set property...
      IF N_B_PRTYPE(cObject, nType, aObjProp[i]) = 'S'
         // Get the members of the set.
         N_B_MEMBERS(cObject, nType, ;
                     aObjProp[i],    ;
                     @aMem, @aMemType)
         // Disconnect a member from the object,
         // and the object from the member.
         FOR j = 1 TO LEN(aMem)
            // Unlink a member from the set.
            N_B_UNLINK(cObject, nType,     ;
                       aObjProp[i],        ;
                       aMem[j], aMemType[j])
            // Get the properties of the member.
            N_B_PRSCAN(aMem[j], aMemType[j], @aMemProp)
            // Examine each property.
            FOR k = 1 TO LEN(aMemProp)
               // If it's a set property and our
               // object is a member...
               IF (N_B_PRTYPE(aMem[j], aMemType[j],   ;
                             aMemProp[k]) = 'S') .AND.;
                  N_B_ISMEMBER(aMem[j], aMemType[j],  ;
                               aMemProp[k],           ;
                               cObject, nType)
                   // Unlink our object.
                   N_B_UNLINK(aMem[j], aMemType[j], ;
                              aMemProp[k],          ;
                              cObject, nType)
               ENDIF
            NEXT k
         NEXT j
      ENDIF
   NEXT i
RETURN



See Also: N_B_DEL() N_B_PRDEL()

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