How to use the dirac.lib.credentials.getSelectedSetup function in DIRAC

To help you get started, we’ve selected a few DIRAC examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / systems / accountingPlots.py View on Github external
def __getUniqueKeyValues( self, typeName ):
    userGroup = getSelectedGroup()
    if 'NormalUser' in CS.getPropertiesForGroup( userGroup ):
      cacheKey = ( getUsername(), userGroup, getSelectedSetup(), typeName )
    else:
      cacheKey = ( userGroup, getSelectedSetup(), typeName )
    data = AccountingplotsController.__keysCache.get( cacheKey )
    if not data:
      rpcClient = getRPCClient( "Accounting/ReportGenerator" )
      retVal = rpcClient.listUniqueKeyValues( typeName )
      if 'rpcStub' in retVal:
        del( retVal[ 'rpcStub' ] )
      if not retVal[ 'OK' ]:
        return retVal

      #Site ordering based on TierLevel / alpha
      if 'Site' in retVal[ 'Value' ]:
        siteLevel = {}
        for siteName in retVal[ 'Value' ][ 'Site' ]:
          sitePrefix = siteName.split( "." )[0].strip()
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / jobs / JobAdministrator.py View on Github external
def getSandbox( self ):
    """ Get job sandbox 
    """
    if 'jobID' not in request.params:
      c.error = "Maybe you forgot the jobID ?"
      return render( "/error.mako" )
    jobID = int(request.params['jobID']) 
    sbType = 'Output'
    if 'sandbox' in request.params:
      sbType = str(request.params['sandbox'])
        
    client = SandboxStoreClient(useCertificates=True,
                                delegatedDN=str( credentials.getUserDN() ),
                                delegatedGroup=str( credentials.getSelectedGroup() ),
                                setup = credentials.getSelectedSetup() )
    result = client.downloadSandboxForJob(jobID,sbType,inMemory=True)
    if not result['OK']:
      c.error = "Error: %s" % result['Message']
      return render( "/error.mako" ) 
    
    data = result['Value'] 
    fname = "%s_%sSandbox.tar" % (str(jobID),sbType)
    response.headers['Content-type'] = 'application/x-tar'
    response.headers['Content-Disposition'] = 'attachment; filename="%s"' % fname
    response.headers['Content-Length'] = len( data )
    return data
github DIRACGrid / -obsolete-DIRACWeb / dirac / lib / diset.py View on Github external
def __prepareArgs( kwargs ):
  if ( 'static' not in kwargs or not kwargs[ 'static' ] ) and credentials.getUserDN():
    kwargs[ 'delegatedGroup' ] =  str( credentials.getSelectedGroup() )
    kwargs[ 'delegatedDN' ] = str( credentials.getUserDN() )
  kwargs[ 'useCertificates' ] = True
  kwargs[ 'setup' ] = credentials.getSelectedSetup()
  return kwargs
github DIRACGrid / -obsolete-DIRACWeb / dirac / lib / webBase.py View on Github external
def htmlSetups():
  selectedSetup = "<strong>%s</strong>" % credentials.getSelectedSetup()
  availableSetups = [ ( setupName, diracURL( controller = 'web/userdata', action = 'changeSetup', id = setupName ) ) for setupName in gWebConfig.getSetups() ]
  return yuiWidgets.dropDownMenu( "UserSetupPos", selectedSetup, availableSetups )
github DIRACGrid / -obsolete-DIRACWeb / dirac / lib / webBase.py View on Github external
def getJSPageData():
  pageData = []
  pageData.append( "navMenu : %s" % getSchemaContents() )
  pageData.append( "setupMenu : %s" % getSetups() )
  pageData.append( "selectedSetup : '%s'" % credentials.getSelectedSetup() )
  pageData.append( "pagePath : %s" % pagePath() )
  pageData.append( "pageName : %s" % pageName() )
  pageData.append( "userData : %s" % getUserData() )
  pageData.append( "docs : %s" % getDoc() ) # by Matvey
  pageData.append( "helpURL : '%s'" % getHelpForPage() ) # by Matvey
  voIcon = gWebConfig.getIconLocation()
  if voIcon:
    pageData.append( "voIcon : '%s'" % voIcon )
    pageData.append( "voURL : '%s'" % gWebConfig.getIconURL() )
  return "{%s}" % ",".join( pageData )