How to use the dirac.lib.credentials 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 / jobs / ProductionMonitor.py View on Github external
def __request(self):
    req = {}
    lhcbGroup = credentials.getSelectedGroup()
    lhcbUser = str(credentials.getUsername())
    global pageNumber
    global numberOfJobs
    global globalSort
    if request.params.has_key("limit") and len(request.params["limit"]) > 0:
      numberOfJobs = int(request.params["limit"])
      if request.params.has_key("start") and len(request.params["start"]) > 0:
        pageNumber = int(request.params["start"])
      else:
        pageNumber = 0
    else:
      numberOfJobs = 25
      pageNumber = 0
    if request.params.has_key("productionID") and len(request.params["productionID"]) > 0:
      gLogger.info(" !!!!!!!!!!!!!!!!!!!!!11 productionID - ",request.params["productionID"])
      testString = str(request.params["productionID"])
      testString = testString.strip(';, ')
github DIRACGrid / -obsolete-DIRACWeb / dirac / lib / webBase.py View on Github external
else:
      userData.append( "groupProperties : []" )
    availableGroups = list()
    for groupName in credentials.getAvailableGroups():
      properties = credentials.getProperties( groupName )
      if not len( properties ) > 0:
        continue
      if ( "Pilot" in properties ) or ( "GenericPilot" in properties ):
        continue
      url = diracURL( controller = 'web/userdata',
                      action = 'changeGroup',
                      id = groupName )
      availableGroups.append( "{ text : '%s', url : '%s' }" %
                                ( groupName , url ) )
    userData.append( "groupMenu : [%s]" % ",".join( availableGroups ) )
  dn = credentials.getUserDN()
  if not dn:
    if 'REQUEST_URI' in request.environ:
      uri = str( request.environ[ 'REQUEST_URI' ] )
    else:
      uri = ""
    dn = "<a href="\&quot;https://%s%s\&quot;">certificate login</a>" % ( str( request.environ[ 'HTTP_HOST' ] ), uri )
  userData.append( "DN : '%s'" % dn )
  return "{%s}" % ",".join( userData )
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / data / StorageDirectory.py View on Github external
def __getSelectionData(self):
    callback = {}
    lhcbGroup = credentials.getSelectedGroup()
    lhcbUser = str(credentials.getUsername())
    if len(request.params) > 0:
      tmp = {}
      for i in request.params:
        tmp[i] = str(request.params[i])
      callback["extra"] = tmp
      gLogger.info(" - ",callback["extra"])
###
    RPC = getRPCClient("DataManagement/StorageUsage")
    result = RPC.getStorageElementSelection()
    if result["OK"]:
      se = []
      if len(result["Value"])>0:
        se.append([str("All")])
        for i in result["Value"]:
          i = i.replace(",",";")
          se.append([i])
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / systems / configuration.py View on Github external
def __getModificator( self ):
    rpcClient = getRPCClient( gConfig.getValue( "/DIRAC/Configuration/MasterServer", "Configuration/Server" ) )
    commiter = "%s@%s - %s" % ( credentials.getUsername(),
                                credentials.getSelectedGroup(),
                                Time.dateTime().strftime( "%Y-%m-%d %H:%M:%S" ) )
    return Modificator( rpcClient, commiter )
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / jobs / SiteGateway.py View on Github external
def display(self):
    lhcbGroup = credentials.getSelectedGroup()
    if lhcbGroup == "visitor":
      return render("/login.mako")
    c.select = self.__getSelectionData()
    gLogger.info("SELECTION RESULTS:",c.select)
    return render("jobs/SiteGateway.mako")
################################################################################
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 / controllers / jobs / RequestMonitor.py View on Github external
def display(self):
    group = credentials.getSelectedGroup()
    if group == "visitor" and credentials.getUserDN == "":
      return render("/login.mako")
    c.select = self.__getSelectionData()
#    if not c.select.has_key("extra"):
#      groupProperty = credentials.getProperties(group)
#      if ( "JobAdministrator" or "JobSharing" ) not in groupProperty: #len(groupProperty) == 1 and groupProperty[0] == "NormalUser":
#        c.select["extra"] = {"owner":credentials.getUsername()}
    return render("jobs/RequestMonitor.mako")
################################################################################
github DIRACGrid / -obsolete-DIRACWeb / dirac / controllers / jobs / PilotMonitor.py View on Github external
def __getSelectionData(self):
    callback = {}
    lhcbGroup = credentials.getSelectedGroup()
    lhcbUser = str(credentials.getUsername())
    if len(request.params) > 0:
      tmp = {}
      for i in request.params:
        tmp[i] = str(request.params[i]).replace('"','')
      callback["extra"] = tmp
###
    RPC = getRPCClient("WorkloadManagement/WMSAdministrator")
    result = RPC.getPilotMonitorSelectors()
    gLogger.info("\033[0;31m RPC.getPilotMonitorSelectors() \033[0m %s" % result)
    if result["OK"]:
      result = result["Value"]
      gLogger.info("\033[0;31m *** \033[0m %s",result)
      if result.has_key("Status") and len(result["Status"]) > 0:
        status = []
        status.append([str("All")])
        for i in result["Status"]: