text
stringlengths
0
234
-- Load the module configuration file
Log.Debug ("Module search path: {0}", Paths);
declare
Base : constant String := Name & ".properties";
Path : constant String := Util.Files.Find_File_Path (Base, Paths);
begin
Plugin.Config.Load_Properties (Path => Path, Prefix => Name & ".", Strip => True);
exception
when Ada.IO_Exceptions.Name_Error =>
Log.Info ("Module configuration file '{0}' does not exist", Path);
Function Definition: procedure Add_Listener (Into : in out Module;
Function Body: Item : in Util.Listeners.Listener_Access) is
begin
Util.Listeners.Add_Listener (Into.Listeners, Item);
end Add_Listener;
-- ------------------------------
-- Find the module with the given name in the application and add the listener to the
-- module listener list.
-- ------------------------------
procedure Add_Listener (Plugin : in Module;
Name : in String;
Item : in Util.Listeners.Listener_Access) is
M : constant Module_Access := Plugin.App.Find_Module (Name);
begin
if M = null then
Log.Error ("Cannot find module {0} to add a lifecycle listener", Name);
else
M.Add_Listener (Item);
end if;
end Add_Listener;
-- ------------------------------
-- Remove a listener from the module listener list.
-- ------------------------------
procedure Remove_Listener (Into : in out Module;
Item : in Util.Listeners.Listener_Access) is
begin
Util.Listeners.Remove_Listener (Into.Listeners, Item);
end Remove_Listener;
-- Get per request manager => look in Request
-- Get per session manager => look in Request.Get_Session
-- Get per application manager => look in Application
-- Get per pool manager => look in pool attached to Application
function Get_Manager return Manager_Type_Access is
procedure Process (Request : in out ASF.Requests.Request'Class;
Response : in out ASF.Responses.Response'Class);
Value : Util.Beans.Objects.Object;
procedure Process (Request : in out ASF.Requests.Request'Class;
Response : in out ASF.Responses.Response'Class) is
pragma Unreferenced (Response);
begin
Value := Request.Get_Attribute (Name);
if Util.Beans.Objects.Is_Null (Value) then
declare
M : constant Manager_Type_Access := new Manager_Type;
begin
Value := Util.Beans.Objects.To_Object (M.all'Unchecked_Access);
Request.Set_Attribute (Name, Value);
Function Definition: function Has_Permission (Name : in Util.Beans.Objects.Object;
Function Body: Entity : in Util.Beans.Objects.Object)
return Util.Beans.Objects.Object is
use type Security.Contexts.Security_Context_Access;
Context : constant Security.Contexts.Security_Context_Access := Security.Contexts.Current;
Perm : constant String := Util.Beans.Objects.To_String (Name);
Result : Boolean;
begin
if Util.Beans.Objects.Is_Empty (Name) or Context = null then
Result := False;
elsif Util.Beans.Objects.Is_Empty (Entity) then
Result := Context.Has_Permission (Perm);
else
declare
P : Entity_Permission (Security.Permissions.Get_Permission_Index (Perm));
begin
P.Entity := ADO.Identifier (Util.Beans.Objects.To_Long_Long_Integer (Entity));
Result := Context.Has_Permission (P);
Function Definition: function Get_Permission_Manager (Context : in Security.Contexts.Security_Context'Class)
Function Body: return Permission_Manager_Access is
use type Security.Policies.Policy_Manager_Access;
M : constant Security.Policies.Policy_Manager_Access
:= Context.Get_Permission_Manager;
begin
if M = null then
Log.Info ("There is no permission manager");
return null;