Changeset eecd42 in indico


Ignore:
Timestamp:
05/19/11 10:38:14 (2 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
f4c27d
Parents:
e8a463
git-author:
Alexis Castilla Hernandez <alexis.castilla.hernandez@…> (05/13/11 17:37:24)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (05/19/11 10:38:14)
Message:

[IMP] Allow authors and co-authors see abstracts

  • Implemented to allow authors and co-authors see the abstracts in "View my abstracts" section in which they are participants
  • Added check protection method to allow access the abstract
  • Using email as key
  • Fixed a bug with the contribution type name in the list of abstracts
  • Ticket #765
Location:
indico/MaKaC
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/review.py

    r066e66 reecd42  
    937937                    res.append( abstract ) 
    938938        return res 
     939 
     940    def getAbstractListForPrimaryAuthorEmail(self, email): 
     941        ''' Get list of abstracts where the email belongs to a primary author 
     942        ''' 
     943        res = [] 
     944        for abs in self._abstracts.values(): 
     945            for author in abs.getPrimaryAuthorList(): 
     946                if email == author.getEmail(): 
     947                    res.append(abs) 
     948        return res 
     949 
     950    def getAbstractListForCoAuthorEmail(self, email): 
     951        ''' Get list of abstracts where the email belongs to a co-author 
     952        ''' 
     953        res = [] 
     954        for abs in self._abstracts.values(): 
     955            for author in abs.getCoAuthorList(): 
     956                if email == author.getEmail(): 
     957                    res.append(abs) 
     958        return res 
     959 
     960    def isInAuthorizedViewList(self, user, abstract): 
     961        ''' Check if the user is submitter, primary author or co-author of the abstract 
     962        ''' 
     963        # Check if the user is a submitter 
     964        if abstract.isSubmitter(user): 
     965            return True 
     966        # Check if the user is a primary author 
     967        for author in abstract.getPrimaryAuthorList(): 
     968            if user.getEmail() == author.getEmail(): 
     969                return True 
     970        # Check if the user is a co-author 
     971        for author in abstract.getCoAuthorList(): 
     972            if user.getEmail() == author.getEmail(): 
     973                return True 
     974        return False 
    939975 
    940976    def getNotificationTplList(self): 
  • indico/MaKaC/webinterface/pages/abstracts.py

    r084dec reecd42  
    187187        tz = tzUtil.getDisplayTZ() 
    188188 
     189        asPrimaryAuthor = cfaMgr.getAbstractListForPrimaryAuthorEmail(self._aw.getUser().getEmail()) 
     190        asCoAuthor = cfaMgr.getAbstractListForCoAuthorEmail(self._aw.getUser().getEmail()) 
    189191        l = cfaMgr.getAbstractListForAvatar( self._aw.getUser() ) 
     192        for abs in asPrimaryAuthor: 
     193            if not abs in l: 
     194                l.append(abs) 
     195        for abs in asCoAuthor: 
     196            if not abs in l: 
     197                l.append(abs) 
     198 
     199        l = sorted(l, key=lambda i:int(i.getId())) 
     200 
    190201        if not l: 
    191202            vars["abstracts"] = _("""<tr> 
     
    204215                    statusLabel = _("ACCEPTED") 
    205216                    if status.getType() is not None and status.getType()!="": 
    206                         statusLabel="%s as %s"%(statusLabel,status.getType()) 
     217                        statusLabel="%s as %s"%(statusLabel,status.getType().getName()) 
    207218                elif isinstance( status, review.AbstractStatusRejected ): 
    208219                    statusLabel = _("REJECTED") 
  • indico/MaKaC/webinterface/rh/CFADisplay.py

    re87fe4 reecd42  
    536536class RHAbstractDisplay( RHAbstractDisplayBase ): 
    537537    _uh = urlHandlers.UHAbstractDisplay 
     538 
     539    def _checkProtection(self): 
     540        if self._abstract is None: 
     541            raise MaKaCError( _("The abstract you are trying to access does not exist")) 
     542        if not self._conf.getAbstractMgr().isInAuthorizedViewList(self._getUser(), self._abstract): 
     543            RHAbstractSubmissionBase._checkProtection(self) 
    538544 
    539545    def _processIfActive( self ): 
Note: See TracChangeset for help on using the changeset viewer.