IMetabaseSecurity.NewSubjectsSearch

Syntax

NewSubjectsSearch: ISecuritySubjectsSearch;

NewSubjectsSearch: Prognoz.Platform.Interop.Metabase.ISecuritySubjectsSearch;

Description

The NewSubjectsSearch method creates an object of security subject search.

Example

To execute the example, add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    Sea: ISecuritySubjectsSearch;
    Subjs: ISecuritySubjects;
    Subj: ISecuritySubject;
    i: integer;
Begin
    MB := MetabaseClass.Active;
    Sea := MB.Security.NewSubjectsSearch;
    Sea.NameCriteria := 
"A*";
    Sea.SubjectCriteria(SecuritySubjectType.User) := 
True;
    Sea.SubjectCriteria(SecuritySubjectType.Group) := 
True;
    Sea.AreaIncludeDB := 
True;
    Sea.AreaIncludeNT := 
True;
    Sea.ExecuteSearch;
    Subjs := Sea.Subjects;
    
If Subjs.Count > 0 Then
        
For i := 0 To Subjs.Count - 1 Do
            Subj := Subjs.Item(i);
            Debug.WriteLine(Subj.Name + 
": " + Subj.Description);
        
End For;
    
End If;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Sea: ISecuritySubjectsSearch;
    Subjs: ISecuritySubjects;
    Subj: ISecuritySubject;
    i: integer;
Begin
    MB := Params.Metabase;
    Sea := MB.Security.NewSubjectsSearch();
    Sea.NameCriteria := 
"A*";
    Sea.SubjectCriteria[SecuritySubjectType.sstUser] := 
True;
    Sea.SubjectCriteria[SecuritySubjectType.sstGroup] := 
True;
    Sea.AreaIncludeDB := 
True;
    Sea.AreaIncludeNT := 
True;
    Sea.ExecuteSearch();
    Subjs := Sea.Subjects;
    
If Subjs.Count > 0 Then
        
For i := 0 To Subjs.Count - 1 Do
            Subj := Subjs.Item[i];
            System.Diagnostics.Debug.WriteLine(Subj.Name + 
": " + Subj.Description);
        
End For;
    
End If;
End Sub;

After executing the example, security subjects - users and groups among domain subjects and DBMS subjects - are searched for. Name and description of the found subjects is displayed in the console.

See also:

IMetabaseSecurity