Changeset 0f06528 for fedd/federation


Ignore:
Timestamp:
Feb 20, 2010 12:44:34 PM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
617592b
Parents:
39ee3cc
Message:

Convert to useing credential strings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/dragon_access.py

    r39ee3cc r0f06528  
    309309        rp = access_project(None, ())
    310310        ru = None
    311 
    312         if req.has_key('project'):
    313             p = req['project']
    314             if p.has_key('name'):
    315                 project = unpack_id(p['name'])
    316             user = self.get_users(p)
    317         else:
    318             user = self.get_users(req)
     311        user_re = re.compile("user:\s(.*)")
     312        project_re = re.compile("project:\s(.*)")
     313
     314        user = [ user_re.findall(x)[0] for x in req.get('credential', []) \
     315                if user_re.match(x)]
     316        project = [ project_re.findall(x)[0] \
     317                for x in req.get('credential', []) \
     318                    if project_re.match(x)]
     319
     320        if len(project) == 1: project = project[0]
     321        elif len(project) == 0: project = None
     322        else:
     323            raise service_error(service_error.req,
     324                    "More than one project credential")
     325
    319326
    320327        user_fedids = [ u for u in user if isinstance(u, fedid)]
     328
    321329        # Determine how the caller is representing itself.  If its fedid shows
    322330        # up as a project or a singleton user, let that stand.  If neither the
Note: See TracChangeset for help on using the changeset viewer.