Скачать презентацию e Directory Creating Novell Utilities Using Active Скачать презентацию e Directory Creating Novell Utilities Using Active

abc7f7aee2ccc833f75c895df7e67508.ppt

  • Количество слайдов: 77

™ e. Directory Creating Novell Utilities Using Active. X www. novell. com Gary J. ™ e. Directory Creating Novell Utilities Using Active. X www. novell. com Gary J. Porter Senior Network Analyst Mind. Works, Inc. of Kentucky porter@digitalme. com

Deployed Versions Novell e. Directory™ and Novell Directory Services® (NDS) Product Version Build Version Deployed Versions Novell e. Directory™ and Novell Directory Services® (NDS) Product Version Build Version Platforms Net. Ware 5. 1 SP 4 (NDS 7) DS. nlm v 7. 57 Net. Ware 5. 1 SP 4 (NDS 8) DS. nlm v 8. 79 Net. Ware 5. 1 e. Directory 8 DS. nlm & DS. dlm v 8. 79 Net. Ware 5. 0, Win NT/2 K e. Directory 8. 5. x DS v 85. 23 Net. Ware 5. x, Win, Solaris Net. Ware 6 (e. Directory 8. 6) DS. nlm v 10110. 20 Net. Ware 6 e. Directory 8. 6. 1 DS v 10210. 43 NW 5. 1, NW 6, Win, Solaris, Linux Net. Ware 6 SP 1 (e. Directory 8. 6. 2) DS. nlm v 10310. 17 Net. Ware 6 e. Directory 8. 6. 2 DS v 103 xx. xx NW 5. 1, NW 6, Win, Solaris, Linux e. Directory 8. 7 DS v 10410. xx NW 5. 1, NW 6, Win, Solaris, Linux, AIX

Differences Between e. Directory and NDS® NDS e. Directory NOS directory focused on managing Differences Between e. Directory and NDS® NDS e. Directory NOS directory focused on managing Net. Ware® servers A cross-platform, scalable, standards-based directory used for managing identities that span all aspects of the network—e. Directory is the foundation for e. Business Net. Ware 5 Net. Ware 6

The History of Active. X • Dynamic Data Exchange (DDE) • Object Linking and The History of Active. X • Dynamic Data Exchange (DDE) • Object Linking and Embedding (OLE) • OLE 2/Component Object Model (COM) • Visual Basic Controls (VBX) • OLE Custom Controls (OCX) • Active. X

Active. X • In 1996, in an attempt to make the technology less confusing, Active. X • In 1996, in an attempt to make the technology less confusing, Microsoft branded the name Active. X and used it to define COM-based technologies • OLE was assigned the mission of referring only to compound documents • Active. X open the door to RAD programming

RAD (Rapid Application Development) • RAD allows reusability • The logic behind this new RAD (Rapid Application Development) • RAD allows reusability • The logic behind this new revolution is simple—in order to keep the costs down and productivity up, the programmer follows four steps, only writing new code when all else fails 1. 2. 3. 4. Re-use existing code Modify existing code Buy someone’s code Write new code • This class is based on RAD—develop applications quickly

Terminology Novell e. Directory™ Active. X 4 Tree 4 Directory 4 Class 4 Layout Terminology Novell e. Directory™ Active. X 4 Tree 4 Directory 4 Class 4 Layout 4 Syntax 4 Field 4 Object 4 Entry 4 Attribute 4 Field 4 Fully 4 Full Distinguished Name 4 Relative Distinguished Name type Name 4 Short Name

NWBind • The Bindery control allow you to 4 Create and delete local users NWBind • The Bindery control allow you to 4 Create and delete local users 4 Search and filter entries 4 Manage passwords 4 Perform backup and restore functions on the local Bindery

NWDir (The Keys to the Kingdom) • With this control, the RAD programmer can NWDir (The Keys to the Kingdom) • With this control, the RAD programmer can 4 Edit *NDS® entries 4 Add objects 4 Delete objects 4 Search for objects * Novell Directory Services®

NWIDir • Provides the functionality to 4 Search and filter LDAP entries 4 Determine NWIDir • Provides the functionality to 4 Search and filter LDAP entries 4 Determine the entry layout and associated fields 4 Return a user name and fields 4 Add, delete and modify LDAP entries

Collections • Groups of like objects • The Active. X controls consists of several Collections • Groups of like objects • The Active. X controls consists of several controls, each with several collections 4 NWDir— 10 collections 4 NWIDir— 8 collections

Directory Collections (NWDir/NWIDir) • NWEntries 4 All objects in the e. Directory instance 4 Directory Collections (NWDir/NWIDir) • NWEntries 4 All objects in the e. Directory instance 4 To add a new user you use the NWEntries collection • NWEntry 4 A single entry 4 A user, itself, is a collection of attributes 4 To display a users attributes, you would use the NWEntry collection

Methods and Properties • Most programmers dealing with Microsoft products have a thorough understanding Methods and Properties • Most programmers dealing with Microsoft products have a thorough understanding of the terms Method and Property but for the sake of those that are new to the visual environment… 4 Property is an attribute of a control 4 Method is a function that an object can perform —What I can do… —A description of me…

Double-click background Double-click background

Project One—Display Trees • Open Visual Basic • Select Standard EXE • Right click Project One—Display Trees • Open Visual Basic • Select Standard EXE • Right click on the “Components” toolbox

Select Novell Session Control Right mouse click Select Novell Session Control Right mouse click

Project One—Display Trees • Add the Session control to the Form • Select “List. Project One—Display Trees • Add the Session control to the Form • Select “List. Box” and wipe across the Form

Project One—Display Trees • Add the Session control to the Form • Select “List. Project One—Display Trees • Add the Session control to the Form • Select “List. Box” and wipe across the Form

Project One—Display Trees • Double-click in the form—not in the List. Box In here… Project One—Display Trees • Double-click in the form—not in the List. Box In here…

NWDir • It is used to set context (which determines which collections are in NWDir • It is used to set context (which determines which collections are in view) and enables the collections that you will use to read information and effect changes • It allows you to search for entries and/or filter entries • If you’re using NDS version 8 (e. Directory), sort collections according to an index • The control itself has eleven properties, nine methods, and four events

NWDir Properties • Entries—(NWEntries Collection) the entries contained in • • • the current NWDir Properties • Entries—(NWEntries Collection) the entries contained in • • • the current context of the directory Entry—(NWEntry object) the root object represented by the current context or Full. Name Field. Types—(NWField. Types collection) the field types or attributes of the directory Filters—(String) allows searching and display of specific layouts at run time Full. Name—(String) sets or displays the current context Layouts—(NWLayout. Description) the object classes or layouts contained in the current tree

NWDir Properties (cont. ) • Login. Name—(String) the Full. Name of the current logged-in NWDir Properties (cont. ) • Login. Name—(String) the Full. Name of the current logged-in • • user Pictures—(NWPictures collection) a collection of bitmaps that iconize standard NDS objects Short. Name—(String) the relative distinguished name of the root most object of the current context Sorted. Entries—(Boolean) sorts the NWEntries collection when set to TRUE (only available for e. Directory) Sort. By—(String) sets or returns the index key to sort the NWEntries collection (only available for e. Directory)

NWDir Methods • Context. From. Full. Name—returns only the context portion • • of NWDir Methods • Context. From. Full. Name—returns only the context portion • • of a Full. Name Find. Entry—locates and establishes a link to an entry in the Directory Find. Next. Entry—returns the following entry from the list sorted by the key specified in the Find. Entry method (only available for e. Directory) Find. Prev. Entry—returns the previous entry from the list sorted by the key specified in Find. Entry (only available for e. Directory) Full. Name. From. Tree. And. Context—concatenates a given tree name and context to form a Full. Name

NWDir Methods (cont. ) • Search—initiates a search of the current context and/or its NWDir Methods (cont. ) • Search—initiates a search of the current context and/or its subordinates for a specific set of elements • Stop. Search—stops the search begun by the search method • Tree. From. Full. Name—returns the name of the tree from the Full. Name property • Search. Limited—used to narrow a search to a specific element, layout, or number of objects

NWDir Events—Event Triggers • Entry. Added—triggers when an entry has been successfully added to NWDir Events—Event Triggers • Entry. Added—triggers when an entry has been successfully added to the tree • Entry. Deleted—triggers when an entry has been successfully deleted from the tree • Refresh. Views—triggers when the current context or tree name has been modified • Search. Completed—triggers when a directory search has been completed

NWDir Collections • • • NWEntries NWEntry NWPictures NWPicture NWLayout Descriptions NWLayout. Description NWField. NWDir Collections • • • NWEntries NWEntry NWPictures NWPicture NWLayout Descriptions NWLayout. Description NWField. Types NWField. Type NWField. Descriptions NWField. Description

Project Three—What’s Here? • In this exercise we’ll display other items at the same Project Three—What’s Here? • In this exercise we’ll display other items at the same context • Place a Label and a List Box on the form

Project Three—What’s Here? Project Three—What’s Here?

What’s Here? —Running What’s Here? —Running

NWEntries Properties • Count—(Long) the number of objects within a collection • Item—(Index) returns NWEntries Properties • Count—(Long) the number of objects within a collection • Item—(Index) returns a specific NWEntry object • Relative. Index—(Boolean) specifies whether an index passed to an item is relative or absolute

NWEntries Methods • Add—used to add an item to the collection • Remove—used to NWEntries Methods • Add—used to add an item to the collection • Remove—used to delete an item from the collection • Refresh—used to refresh the contents of the collection

NWEntries • If you think about it, there are few things you can do NWEntries • If you think about it, there are few things you can do with an entire collection, except 4 Displaying it 4 Adding to it 4 Deleting from it

Add Items Method • To add items to a collection, you must supply the Add Items Method • To add items to a collection, you must supply the control with the layout and the object name NWDir 1. Entries. Add(layout, object. Name) • A layout represents the recipe for an entire class of objects • A layout describes the very essence of what the object is—for instance, User or Printer or Server In NDS and e. Directory, the concept of layout is complicated (mostly because of inheritance, super classes and base classes)

Add Items Method • X. 500 rules state that a user must have a Add Items Method • X. 500 rules state that a user must have a surname before it can be created • It may seem a little strange that an entity must have an attribute before it is created • We’ll explore this as soon as we have a few more tricks up our sleeve…however, it looks something like this 4 4 Dim Add. Object As NWEntry Set Add. Object = NWDir 1. Entries. Add("User", "Jan")

Remove Item Method • Removing or deleting objects within a collection is rather simple Remove Item Method • Removing or deleting objects within a collection is rather simple and merely reference the object in the function • Remember, however, the current collection of entries is represented by the current context-only the named object in the current context will be deleted 4 4 Dim Success as Boolean Success = NWDir 1. Entries. Remove("Ken")

Refresh Method • The refresh method is used to reload the contents of a Refresh Method • The refresh method is used to reload the contents of a collection 4 NWDir 1. Entries. Refresh

NWEntry Properties • Alias—(Boolean) indicates if an entry is an alias of another • NWEntry Properties • Alias—(Boolean) indicates if an entry is an alias of another • • entry Entries—(Abstracts the NWEntries collection) returns the contents of a container Full. Name—(String) returns the fully qualified distinguished name of the selected context Image. Index—(String) the index key that’s used to locate a corresponding icon or bitmap in NWDir. Pictures Layout—(NWLayout. Description) returns information on the object class of an entry

NWEntry Properties • Other. Names—(Variant) returns additional values (if present) for the Short. Name NWEntry Properties • Other. Names—(Variant) returns additional values (if present) for the Short. Name property • Partition. Root—(Boolean) indicates whether an entry is a Partition Root object by returning True or False if the object is not a Partition Root object • Short. Name—(String) returns the relative distinguished name of an object • Tag—(String) a user-defined property available for programming purposes

NWEntry Methods • Update/abort • Get. Field. Value • Update. Field. Value. From. File NWEntry Methods • Update/abort • Get. Field. Value • Update. Field. Value. From. File • Save. Field. Value. To. File • Set. Field. Value • Set. Password • Validate. Password • Move als ith De w l tly dua os vi m di ts in bjec o

Update/Abort Methods • Once an entry has been successfully defined, the Update method is Update/Abort Methods • Once an entry has been successfully defined, the Update method is used to “seal the deal” and actually create the object in e. Directory If Something then Object. Update Else Object. Abort End if

Project Four—Add a User (Using NWDir) • Open new “Standard EXE” project • Add Project Four—Add a User (Using NWDir) • Open new “Standard EXE” project • Add the Novell Directory Control to the form • Add and run Dim Success As NWEntry Set Success = NWDir 1. Entries. Add("User", "Anna") If Success. Set. Field. Value("Surname", "Kerr") Then Success. Update Else Success. Abort End If

Get. Field. Value Method • Similar to Set. Field. Value—this method is used to Get. Field. Value Method • Similar to Set. Field. Value—this method is used to retrieve the contents of an attribute Object. Get. Field. Value(Field. Name, Default. Value, Force. As. Array)

Get. Field. Value Method Private Sub Form_Load() DIM NDSObj as NWEntry ' find Jan's Get. Field. Value Method Private Sub Form_Load() DIM NDSObj as NWEntry ' find Jan's entry in NDS Set NDSObj = NWDir 1. Find. Entry("NDS: \MWI_INCMWIAccountsJan") ' fill the contents of Label 1 with information about the subject Label 1. Caption = "Attributes for " + NDSObj. Short. Name ' list the contents of all attributes in the array List 1 For Each Entry In NDSObj. Get. Field. Value("", True) List 1. Add. Item (Entry) Next End Sub

LDAP • But…LDAP is where it’s at these days • The Active. X Control LDAP • But…LDAP is where it’s at these days • The Active. X Control for LDAP is NWIDir • Similar to NWDir 4 NWEntries 4 NWEntry

Open a Project, Standard EXE Right mouse click Open a Project, Standard EXE Right mouse click

NWIDir Control Properties Right mouse click NWIDir Control Properties Right mouse click

Set the Initial LDAP Namespace Instance Press Enter Set the Initial LDAP Namespace Instance Press Enter

Simple LDAP Search Engine Simple LDAP Search Engine

Form Layout Toolbar Add the NWDir Control Form Layout Toolbar Add the NWDir Control

Form Layout Toolbar Text. Box, Text 1 Form Layout Toolbar Text. Box, Text 1

Form Layout Toolbar Label, Label 1 Caption = “Server address and search base” Form Layout Toolbar Label, Label 1 Caption = “Server address and search base”

Form Layout Toolbar Option. Button, Option 1 Form Layout Toolbar Option. Button, Option 1

Form Layout Toolbar Option. Button, Option 2 Form Layout Toolbar Option. Button, Option 2

Form Layout Toolbar Label, Label 2 Caption = “Long Names” Let’s label the options Form Layout Toolbar Label, Label 2 Caption = “Long Names” Let’s label the options

Form Layout Toolbar Label, Label 2 Caption = “Short Names” Form Layout Toolbar Label, Label 2 Caption = “Short Names”

Form Layout Toolbar List. Box, List 1 Form Layout Toolbar List. Box, List 1

Form Layout Toolbar Command. Button, Command 1 Caption = “&Browse” Form Layout Toolbar Command. Button, Command 1 Caption = “&Browse”

Form Layout Toolbar Command. Button, Command 2 Caption = “E&xit” Form Layout Toolbar Command. Button, Command 2 Caption = “E&xit”

Last Asthetic Move… Walking-N-Man. bmp Last Asthetic Move… Walking-N-Man. bmp

Now for the Code • First we’ll fill Text 1 with the default LDAP Now for the Code • First we’ll fill Text 1 with the default LDAP Namespace • We’ll make Option 1 the default Option • Next, we’ll fill List 1 after pressing the Browse button • Lastly, we’ll provide an Exit button

Now for the Code • Double click inside the form, making sure not to Now for the Code • Double click inside the form, making sure not to double-click on one of the controls placed on the page

The Code (Form_Load) • The main form is easy enough Private Sub Form_Load() Option The Code (Form_Load) • The main form is easy enough Private Sub Form_Load() Option 1 = True Text 1. Text = NWIDir 1. Full. Name End Sub • Option 1 is made default by making it “True” • Assigning a value to Text 1 is accomplished by specifying the Full. Name property of the control (NWIDir) 4 Remember that each copy of the control placed on the page will be an instance, in this case instance one is NWIDir 1

The Code—Command 1_Click Private Sub Command 1_Click() List 1. Clear NWIDir 1. Full. Name The Code—Command 1_Click Private Sub Command 1_Click() List 1. Clear NWIDir 1. Full. Name = Text 1. Text Set LDAPEntry = NWIDir 1. Find. Entry(Text 1. Text) Set LDAPEntries = LDAPEntry. Entries For Each Entry In LDAPEntries If Option 1 Then List 1. Add. Item (Entry. Full. Name) Else List 1. Add. Item (Entry. Short. Name) End If Next End Sub

The Code—Command 1_Click (cont. ) • When the Browse button is clicked, we first The Code—Command 1_Click (cont. ) • When the Browse button is clicked, we first clear the list, List 1 4 Otherwise each subsequent click would fill the list with new contents, making it larger and larger • Next we assign the context with the value of Text 1 4 It may seem redundant to do this here but by doing so, we give the user the opportunity to change the value of Text 1—to indicate a LDAP repository and searchbase different from the default

The Code—Command 1_Click (cont. ) • Next we focus on a specific LDAP search The Code—Command 1_Click (cont. ) • Next we focus on a specific LDAP search base by setting the value of LDAPEntry 4 This method is commonly used to indicate a beginning container • We also set LDAPEntries to the property of LDAPEntry— Entries which indicates that we are interested in the collection of “things” at the context “LDAPEntry” which was set from Text 1. Text • It may seem convoluted now but it will make perfect sense after you’ve done it a few times

The Code—Command 1_Click (cont. ) • Finally, we fill the List. Box with the The Code—Command 1_Click (cont. ) • Finally, we fill the List. Box with the “things” we have found in the collection LDAPEntry. Entries • The last thing to do is to provide an exit 4 To do this simply place “End” on the Command. Button Click Private Sub Command 2_Click() End Sub

The Code from Form 1 The Code from Form 1

Short and Long Options Short and Long Options

Conclusion • There are millions of lines of code to be written with the Conclusion • There are millions of lines of code to be written with the Novell Controls for Active. X • It’s easy (and fun) • Attend the hands-on session DCB 104 e. Directory Programming with Visual Basic and Active. X