Search for particular Text in all modules

Hi,

I am trying to find if a particular text is found in any of the modules and we have over 500 modules in an environment. We have some hash code which are used for authentication and want to know if their is any way we can search for that hash code which are hard coded in the one of the action.

I know that if we use site property I can search in OSSYS_SITE_PROPERTY_SHARED table and find out but can't seem to find a shorter way to check for hardcoded value.

Regards.

Hi Prasad,

There really is no way, unless you have an on-premise installation in which case you could search through the .cs files.

But a good example for why it is never a good idea to use hard-coded values like this...

Hi Kilian,

Thanks for the response. In this case, do you know if its possible to find the usage of particular action from system module in other module. I am currently interested in the usages of user_login action from users module or Login action from system module.

Use case: For our Audit we have to know all the accounts that are being used in integration method. So far I have around 90 different rest methods exposed in my environment (pretty much all are used internally and have well documentation for the API which we expose), if I can at least know what login mechanism is being used then atleast I can manually check all the places where the API which use Login action from system module is being called and get the details, which is what I am interested in.

Regards.

Solution

Hi Prasad,

This should do the trick:

SELECT {Espace}.*

FROM {Espace}
INNER JOIN {Espace_Version} ON {Espace_Version}.[Id] = (
    SELECT TOP 1 {Espace_Version}.[Id]
    FROM {Espace_Version}
    WHERE {Espace_Version}.[eSpace_Id] = {Espace}.[Id]
    ORDER BY {Espace_Version}.[Uploaded_Date] DESC
    )
INNER JOIN {Espace_Reference} ON {Espace_Reference}.[Consumer_Version_Id] = {Espace_Version}.[Id]
    AND {Espace_Reference}.[Name] = @RefToFind

WHERE {Espace}.[Is_Active] = 1
    AND {Espace}.[Is_System] = 0

ORDER BY {Espace}.[Name]

where @RefToFind is an Input Parameter of type Text.

Solution

Thanks Kilian. I am using oracle so above query does not work me but definitely gave the idea of which table and how to pull the information.

Regards. 

You're welcome! Though I'm curious what Oracle doesn't like about it, I assumed this is standard SQL.

Hi,

It was complaining about below statement and giving ORA-00923: FROM keyword not found where expected error

INNER JOIN {Espace_Version} ON {Espace_Version}.[Id] = (
    SELECT TOP 1 {Espace_Version}.[Id]
    FROM {Espace_Version}
    WHERE {Espace_Version}.[eSpace_Id] = {Espace}.[Id]
    ORDER BY {Espace_Version}.[Uploaded_Date] DESC
    )

Anyway I think we do not need that because we easily join on {Espace}.[Version_Id], this should also handle the case where the published version is not the last uploaded version.

SELECT {Espace}.*
FROM {Espace}
INNER JOIN {Espace_Version} ON {Espace_Version}.[Id] = {Espace}.[Version_Id]
INNER JOIN {Espace_Reference} ON {Espace_Reference}.[Consumer_Version_Id] = {Espace_Version}.[Id] AND {Espace_Reference}.[Name] = @RefToFind
WHERE {Espace}.[Is_Active] = 1
    AND {Espace}.[Is_System] = 0
ORDER BY {Espace}.[Name]

Extending it little further I was able to write something like below which can give me the espaces which has login or user_login action as depandant and has some rest service exposed. Thanks for all the help.

SELECT "OSSYS_ESPACE"."ID", 
    "OSSYS_ESPACE"."NAME",
    max(CASE
        WHEN "OSSYS_ESPACE_REFERENCE"."NAME" = 'Login' THEN 1
        ELSE 0
    END) HaveLogin,
    max(CASE
        WHEN "OSSYS_ESPACE_REFERENCE"."NAME" = 'User_Login' THEN 1
        ELSE 0
    END) HaveUserLogin
FROM  "OSSYS_ESPACE"
INNER JOIN  "OSSYS_REST_EXPOSE" ON ("OSSYS_ESPACE".ID = "OSSYS_REST_EXPOSE".ESPACE_ID)
INNER JOIN  "OSSYS_ESPACE_VERSION" ON  "OSSYS_ESPACE_VERSION"."ID" =  "OSSYS_ESPACE"."VERSION_ID" 
LEFT JOIN  "OSSYS_ESPACE_REFERENCE" ON  "OSSYS_ESPACE_REFERENCE"."CONSUMER_VERSION_ID" =  "OSSYS_ESPACE_VERSION"."ID" 
    AND  "OSSYS_ESPACE_REFERENCE"."NAME" in ('Login', 'User_Login')
WHERE  "OSSYS_ESPACE"."IS_ACTIVE" = 1 
    AND  "OSSYS_ESPACE"."IS_SYSTEM" = 0
    AND "OSSYS_REST_EXPOSE".IS_ACTIVE = 1
GROUP BY "OSSYS_ESPACE"."ID", "OSSYS_ESPACE"."NAME"
ORDER BY  "OSSYS_ESPACE"."NAME";

Regards.