with Subsystem_Pathname;
with Directory_Tools;
with Authorization_List;
with System_Utilities;
with String_Utilities;
with Access_List;
function Check_Authorization (What_Object : String) return Boolean is

    package Su renames String_Utilities;
    package Naming renames Directory_Tools.Naming;
    package Object renames Directory_Tools.Object;

    Granted : Boolean := False;
    Obj : Object.Handle := Naming.Resolution (What_Object);
    Iter : Object.Iterator;

begin

    declare
        Full_Name : constant String := Naming.Full_Name (Obj);
    begin

        if Full_Name'Length >= Subsystem_Pathname'Length and then
           Full_Name (1 .. Subsystem_Pathname'Length) = Subsystem_Pathname then
            Big_Loop:
                for I in Authorization_List.Master_Authorization'Range loop


                    Iter :=
                       Naming.Resolution
                          (Subsystem_Pathname & "." &
                           Su.Strip_Trailing
                              (Authorization_List.Master_Authorization (I).
                               View) & ".units." &
                           Authorization_List.Master_Authorization (I).Units);

                    if Object.Has (Iter, Obj) then

                        for J in Authorization_List.Master_Authorization (I).
                                    Users'Range loop
                            if String_Utilities.Upper_Case
                                  (String_Utilities.Strip
                                      (Authorization_List.Master_Authorization
                                          (I).Users (J))) =
                               System_Utilities.User_Name then

                                -- grant the checker_outer the only id
                                -- to have write access.
                                --  Access_List.Add
                                --     (To_List =>
                                --         System_Utilities.User_Name & "=>RW",
                                --      For_Object => What_Object,
                                --      Response => "<PROFILE>");


                                Granted := True;
                                exit Big_Loop;

                            end if;
                        end loop;
                    end if;
                end loop Big_Loop;
        else
            -- no special checking for these subsystems
            Granted := True;
        end if;
    end;
    return Granted;
end Check_Authorization;