Skip to content

#5002 Error, <Protect> loading Source control menu #243

@nickmitchko

Description

@nickmitchko

Overview

When using the Git source control plugin with a user of limited privileges, the source control menu fails to load with a 5002 Protect Error on the DefaultTemp() method

image

Reproduce

Create a user with the following roles:

Role Grant
%DB_<Some namespace> No
%Developer No
%EnsRole_Administrator No
%EnsRole_AlertAdministrator No
%EnsRole_AlertOperator No
%EnsRole_Developer No
%EnsRole_Operator No
%EnsRole_PubSubDeveloper No
%EnsRole_RegistrySelect No
%EnsRole_RulesDeveloper No
%EnsRole_TempSQLDict No
%EnsRole_WebDeveloper No

Potential Fix

ClassMethod DefaultTemp() As %String [ CodeMode = expression ]
{
$Get(@..InstallNamespaceStorage()@("%defaultTemp"), "c:\temp\")
}

ClassMethod MakeError(msg As %String) As %Status [ CodeMode = expression, Private ]
{
$$$ERROR(8012,"Git",msg)
}

ClassMethod TempFolder() As %String
{
    set context = ##class(SourceControl.Git.PackageManagerContext).%Get()
    if context.IsInGitEnabledPackage {
        quit context.Package.Root
    }
    quit ..DefaultTempFolder()
}

ClassMethod DefaultTempFolder() As %String
{
    set temp = "c:\temp\"
    Try {
        set temp = ..DefaultTemp()
    } Catch exception {
        // Silent exception
    }
    quit $get(@..#Storage@("settings","namespaceTemp"),temp_$translate($znspace,"%")_..#Slash)
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions