Changeset 02505d in indico


Ignore:
Timestamp:
06/10/10 18:11:31 (3 years ago)
Author:
Jeremy Herr <jeremy.herr@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, new-webex, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
d531f9
Parents:
624b57
git-author:
Jeremy Herr <jeremy.herr@…> (03/16/10 17:06:20)
git-committer:
Jeremy Herr <jeremy.herr@…> (06/10/10 18:11:31)
Message:

[IMP] Deal with users/groups differently

Jerome C of CDS wants to put users and groups into two separate blocks, so I did that.

Also added an optional "source" argument to both confToXMLMarc21() and _confToXMLMarc21().
It will only generate the access list info if this arg is set to 'RecordingManager?'.
No need to provide access list info to anyone outside CERN.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/common/output.py

    r624b57 r02505d  
    878878    #fb 
    879879 
    880     def confToXMLMarc21(self,conf,includeSession=1,includeContribution=1,includeMaterial=1,out=None, forceCache=False): 
     880    def confToXMLMarc21(self,conf,includeSession=1,includeContribution=1,includeMaterial=1,out=None, forceCache=False, source=None): 
    881881 
    882882        if not out: 
     
    892892            # No cache, build the XML 
    893893            temp = XMLGen(init=False) 
    894             self._confToXMLMarc21(conf,includeSession,includeContribution,includeMaterial, out=temp) 
     894            self._confToXMLMarc21(conf,includeSession,includeContribution,includeMaterial, out=temp, source=source) 
    895895            xml = temp.getXml() 
    896896            # save XML in cache 
     
    898898        out.writeXML(xml) 
    899899 
    900     def _confToXMLMarc21(self,conf,includeSession=1,includeContribution=1,includeMaterial=1,out=None): 
     900    def _confToXMLMarc21(self,conf,includeSession=1,includeContribution=1,includeMaterial=1,out=None, source=None): 
    901901        if not out: 
    902902            out = self._XMLGen 
     
    10591059        # Access control information, if event is protected 
    10601060        # Get set containing Avatar objects (if empty, that means event is public) 
    1061         allowed_avatars = conf.getRecursiveAllowedToAccessList() 
    1062         if allowed_avatars is not None and len(allowed_avatars) > 0: 
    1063             # Build a list holding email strings instead of Avatar objects 
    1064             allowed_emails = [] 
    1065             for av in allowed_avatars: 
    1066                 if isinstance(av, Avatar): 
    1067                     allowed_emails.append(av.getEmail()) 
    1068                 elif isinstance(av, CERNGroup): 
    1069                     allowed_emails.append(av.getId() + " [CERN]") 
    1070                 else: 
    1071                     allowed_emails.append("UNKNOWN: %s" % av.getId()) 
    1072  
    1073             out.openTag("marc:datafield",[["tag","506"], ["ind1","1"], ["ind2"," "]]) 
    1074             out.writeTag("marc:subfield", "Restricted",  [["code", "a"]]) 
    1075             for email_id in allowed_emails: 
    1076                 out.writeTag("marc:subfield", email_id,  [["code", "d"]]) 
    1077             out.writeTag("marc:subfield", "group",       [["code", "f"]]) 
    1078             out.writeTag("marc:subfield", "CDS Invenio", [["code", "2"]]) # <-- should not be hard coded here 
    1079             out.writeTag("marc:subfield", "SzGeCERN",    [["code", "5"]]) # <-- should not be hard coded here 
    1080             out.closeTag("marc:datafield") 
     1061        if source is not None and source == 'RecordingManager': 
     1062            allowed_users = conf.getRecursiveAllowedToAccessList() 
     1063            if allowed_users is not None and len(allowed_users) > 0: 
     1064                # Populate two lists holding email/group strings instead of Avatar/Group objects 
     1065                allowed_emails = [] 
     1066                allowed_groups = [] 
     1067                for av in allowed_users: 
     1068                    if isinstance(av, Avatar): 
     1069                        allowed_emails.append(av.getEmail()) 
     1070                    elif isinstance(av, CERNGroup): 
     1071                        allowed_groups.append(av.getId() + " [CERN]") 
     1072                    else: 
     1073                        allowed_emails.append("UNKNOWN: %s" % av.getId()) 
     1074 
     1075                out.openTag("marc:datafield",[["tag","506"], ["ind1","1"], ["ind2"," "]]) 
     1076                out.writeTag("marc:subfield", "Restricted",  [["code", "a"]]) 
     1077                for email_id in allowed_groups: 
     1078                    out.writeTag("marc:subfield", email_id,  [["code", "d"]]) 
     1079                out.writeTag("marc:subfield", "group",       [["code", "f"]]) 
     1080                out.writeTag("marc:subfield", "CDS Invenio", [["code", "2"]]) # <-- should not be hard coded here 
     1081                out.writeTag("marc:subfield", "SzGeCERN",    [["code", "5"]]) # <-- should not be hard coded here 
     1082                out.closeTag("marc:datafield") 
     1083 
     1084                out.openTag("marc:datafield",[["tag","506"], ["ind1","1"], ["ind2"," "]]) 
     1085                out.writeTag("marc:subfield", "Restricted",  [["code", "a"]]) 
     1086                for email_id in allowed_emails: 
     1087                    out.writeTag("marc:subfield", email_id,  [["code", "d"]]) 
     1088                out.writeTag("marc:subfield", "email",       [["code", "f"]]) 
     1089                out.writeTag("marc:subfield", "CDS Invenio", [["code", "2"]]) # <-- should not be hard coded here 
     1090                out.writeTag("marc:subfield", "SzGeCERN",    [["code", "5"]]) # <-- should not be hard coded here 
     1091                out.closeTag("marc:datafield") 
    10811092 
    10821093    ## def sessionToXMLMarc21(self,session,includeMaterial=1, out=None, forceCache=False): 
Note: See TracChangeset for help on using the changeset viewer.