Finding Objects with explicit permissions, for tables we do not have access to

robbonickrobbonick Posts: 39Member
Hi,

I am trying to use some of the source code management tools available in VS Code for C/SIDE.
Specifically this extension - NAVBaas Git

It all seems great, but we are an end user running NAV 2017, and have are having some license issues.
For instance, I want to start my docker container and import all our objects into the container as .txt files.

This works fine, until we hit some objects which have permissions to tables we can't insert into etc.
For example, Report 795 - Adjust Cost - Item Entries, which has the following permissions...
TableData Item Ledger Entry=rimd,TableData Item Application Entry=r,TableData Value Entry=rimd,TableData Avg. Cost Adjmt. Entry Point=rimd

So looking at this object, it has been modified by a previous partner. So we would like to investigate if this is still required, or can it be refactored etc.

I am just wondering if there is a way, through powershell or through some custom page in NAV where I can find out all the objects which have these permissions, on objects we can't insert into etc. So we can investigate each object, and see if we can remove the modification or refactor it to use events.

Importing the objects as a FOB will work fine, but when importing as .txt we get the error and obviously FOB is useless for SCM.

Any advice would be appreciated.

Best Answer

  • robbonickrobbonick Posts: 39
    Accepted Answer
    Thanks for the input, sometimes the non technical solutions are the best.

    In the end I created a script in PowerShell, if you are interested here it is....
    Import-NAVModules
    $StandardObjectsPath = "C:\Temp\ObjectCompare\BaseObjects\Standard"
    $CustomObjectsPath = "C:\Temp\ObjectCompare\BaseObjects\Custom"
    $DeltaOutputPath = "C:\Temp\ObjectCompare\Output\Delta"
    $ModWithPermissionsPath = "C:\Temp\ObjectCompare\Output\ModifiedObjectsWithPermissions"
    
    $CustomObjectsPath = Join-Path $CustomObjectsPath "*.txt"
    $CustomObjects = Get-ChildItem $CustomObjectsPath
    
    foreach ($CustomObject in $CustomObjects) {
        $FileToFind = Join-Path $StandardObjectsPath $CustomObject.Name
        if (Test-Path $FileToFind) {
            $Result = Compare-NAVApplicationObject -OriginalPath $FileToFind -ModifiedPath $CustomObject.FullName -DeltaPath $DeltaOutputPath
            if ($Result.CompareResult -eq 'Delta') {
                $Expression = 'Permissions=TableData'           
                $Result2 = Select-String -Pattern $Expression -Path $CustomObject.FullName -Quiet
                if ($Result2) {
                    Copy-Item $CustomObject.FullName -Destination $ModWithPermissionsPath               
                }           
            }
        }
    }
    

Answers

  • SanderDkSanderDk Posts: 179Member
    edited 2018-12-07
    The simple thing would be you use a grep search on your folder for "RIMD" .
    Not a very technical solution i know ;)
    You can have a look at grepwin :)
    For help, do not use PM, but use forum instead, perhaps other people have the same question, or better answers.
  • robbonickrobbonick Posts: 39Member
    Accepted Answer
    Thanks for the input, sometimes the non technical solutions are the best.

    In the end I created a script in PowerShell, if you are interested here it is....
    Import-NAVModules
    $StandardObjectsPath = "C:\Temp\ObjectCompare\BaseObjects\Standard"
    $CustomObjectsPath = "C:\Temp\ObjectCompare\BaseObjects\Custom"
    $DeltaOutputPath = "C:\Temp\ObjectCompare\Output\Delta"
    $ModWithPermissionsPath = "C:\Temp\ObjectCompare\Output\ModifiedObjectsWithPermissions"
    
    $CustomObjectsPath = Join-Path $CustomObjectsPath "*.txt"
    $CustomObjects = Get-ChildItem $CustomObjectsPath
    
    foreach ($CustomObject in $CustomObjects) {
        $FileToFind = Join-Path $StandardObjectsPath $CustomObject.Name
        if (Test-Path $FileToFind) {
            $Result = Compare-NAVApplicationObject -OriginalPath $FileToFind -ModifiedPath $CustomObject.FullName -DeltaPath $DeltaOutputPath
            if ($Result.CompareResult -eq 'Delta') {
                $Expression = 'Permissions=TableData'           
                $Result2 = Select-String -Pattern $Expression -Path $CustomObject.FullName -Quiet
                if ($Result2) {
                    Copy-Item $CustomObject.FullName -Destination $ModWithPermissionsPath               
                }           
            }
        }
    }
    
Sign In or Register to comment.