Changeset a89f94 in indico


Ignore:
Timestamp:
08/12/10 15:36:14 (3 years ago)
Author:
Jose Benito <jose.benito.gonzalez@…>
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, b8c30da8ebdbdcbd675a873997cc3e95f567de49, 4287315ec967a3da168d83963c14001db8487d53
Children:
4dd389, 84d986
Parents:
ae68ec
git-author:
Ian Rolewicz <ian.rolewicz@…> (06/29/10 14:46:02)
git-committer:
Jose Benito <jose.benito.gonzalez@…> (08/12/10 15:36:14)
Message:

[IMP] Access Protection Frame Improvement

  • fixes #429
  • The Access Control frame used to set the protection of a category/event/session/contribution has been modified in order to be more understandable and more intuitive.
  • In addition:

-> replaced the synchronous adding of users to the list of

allowed users by the corresponding Widget. Ajax methods for
getting, adding to and removing from this list were added
for each type of objects.

-> refactoring to a common .tpl and creation of a special

template for the 'Home' category

Location:
indico
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/services/implementation/category.py

    r701dc2 ra89f94  
    88import MaKaC.conference as conference 
    99from MaKaC.common.logger import Logger 
    10 from MaKaC.services.interface.rpc.common import ServiceError 
     10from MaKaC.services.interface.rpc.common import ServiceError, ServiceAccessError 
    1111import MaKaC.webinterface.locators as locators 
    1212from MaKaC.webinterface.wcomponents import WConferenceList, WConferenceListEvents 
     13from MaKaC.common.fossilize import fossilize 
     14from MaKaC.user import PrincipalHolder, Avatar, Group 
    1315 
    1416class CategoryBase(object): 
     
    141143        return WConferenceListEvents(pastEvents, self._aw).getHTML() 
    142144 
     145class CategoryProtectionUserList(CategoryModifBase): 
     146    def _getAnswer(self): 
     147        #will use IAvatarFossil or IGroupFossil 
     148        return fossilize(self._categ.getAllowedToAccessList()) 
     149 
     150class CategoryProtectionAddUsers(CategoryModifBase): 
     151    def _checkParams(self): 
     152 
     153        CategoryModifBase._checkParams(self) 
     154 
     155        self._usersData = self._params['value'] 
     156        self._user = self.getAW().getUser() 
     157 
     158    def _getAnswer(self): 
     159 
     160        for user in self._usersData : 
     161 
     162            userToAdd = PrincipalHolder().getById(user['id']) 
     163 
     164            if not userToAdd : 
     165                raise ServiceError("ERR-U0","User does not exist!") 
     166 
     167            self._categ.grantAccess(userToAdd) 
     168 
     169class CategoryProtectionRemoveUser(CategoryModifBase): 
     170 
     171    def _checkParams(self): 
     172        CategoryModifBase._checkParams(self) 
     173 
     174        self._userData = self._params['value'] 
     175 
     176        self._user = self.getAW().getUser() 
     177 
     178    def _getAnswer(self): 
     179 
     180        userToRemove = PrincipalHolder().getById(self._userData['id']) 
     181 
     182        if not userToRemove : 
     183            raise ServiceError("ERR-U0","User does not exist!") 
     184        elif isinstance(userToRemove, Avatar) or isinstance(userToRemove, Group) : 
     185            self._categ.revokeAccess(userToRemove) 
    143186 
    144187methodMap = { 
    145188    "getCategoryList": GetCategoryList, 
    146189    "getPastEventsList": GetPastEventsList, 
    147     "canCreateEvent": CanCreateEvent 
     190    "canCreateEvent": CanCreateEvent, 
     191    "protection.getAllowedUsersList": CategoryProtectionUserList, 
     192    "protection.addAllowedUsers": CategoryProtectionAddUsers, 
     193    "protection.removeAllowedUser": CategoryProtectionRemoveUser 
    148194    } 
  • indico/MaKaC/services/implementation/conference.py

    r84c86e ra89f94  
    1414from MaKaC.common.PickleJar import DictPickler 
    1515from MaKaC.common import indexes, info 
     16from MaKaC.common.fossilize import fossilize 
    1617 
    1718from MaKaC.conference import ConferenceHolder 
     
    2627import MaKaC.common.timezoneUtils as timezoneUtils 
    2728from MaKaC.common.contextManager import ContextManager 
     29from MaKaC.user import PrincipalHolder, Avatar, Group 
    2830 
    2931import datetime 
     
    3436from MaKaC.i18n import _ 
    3537 
    36 from MaKaC.services.interface.rpc.common import ServiceError, Warning, ResultWithWarning, TimingNoReportError 
     38from MaKaC.services.interface.rpc.common import ServiceError, Warning, \ 
     39        ResultWithWarning, TimingNoReportError, ServiceAccessError 
    3740 
    3841class ConferenceBase(object): 
     
    4548        try: 
    4649            self._target = self._conf = ConferenceHolder().getById(self._params["conference"]); 
     50        except: 
     51            try: 
     52                self._target = self._conf = ConferenceHolder().getById(self._params["confId"]); 
     53            except: 
     54                raise ServiceError("ERR-E4", "Invalid conference id.") 
    4755            if self._target == None: 
    4856                Logger.get('rpc.conference').debug('self._target is null') 
    4957                raise Exception("Null target.") 
    50         except: 
    51             raise ServiceError("ERR-E4", "Invalid conference id.") 
    5258 
    5359 
     
    649655 
    650656        return p.getHTML(params) 
     657 
     658class ConferenceProtectionUserList(ConferenceModifBase): 
     659 
     660    def _getAnswer(self): 
     661        #will use IAvatarFossil or IGroupFossil 
     662        return fossilize(self._conf.getAllowedToAccessList()) 
     663 
     664class ConferenceProtectionAddUsers(ConferenceModifBase): 
     665 
     666    def _checkParams(self): 
     667        ConferenceModifBase._checkParams(self) 
     668 
     669        self._usersData = self._params['value'] 
     670        self._user = self.getAW().getUser() 
     671 
     672    def _getAnswer(self): 
     673 
     674        for user in self._usersData : 
     675 
     676            userToAdd = PrincipalHolder().getById(user['id']) 
     677 
     678            if not userToAdd : 
     679                raise ServiceError("ERR-U0","User does not exist!") 
     680 
     681            self._conf.grantAccess(userToAdd) 
     682 
     683class ConferenceProtectionRemoveUser(ConferenceModifBase): 
     684 
     685    def _checkParams(self): 
     686        ConferenceModifBase._checkParams(self) 
     687 
     688        self._userData = self._params['value'] 
     689 
     690        self._user = self.getAW().getUser() 
     691 
     692    def _getAnswer(self): 
     693 
     694        userToRemove = PrincipalHolder().getById(self._userData['id']) 
     695 
     696        if not userToRemove : 
     697            raise ServiceError("ERR-U0","User does not exist!") 
     698        elif isinstance(userToRemove, Avatar) or isinstance(userToRemove, Group) : 
     699            self._conf.revokeAccess(userToRemove) 
     700 
    651701 
    652702methodMap = { 
     
    670720#    "getFields": ConferenceGetFields, 
    671721    "getFieldsAndContribTypes": ConferenceGetFieldsAndContribTypes, 
    672     "getParticipationForm": ConferenceParticipationForm 
     722    "getParticipationForm": ConferenceParticipationForm, 
     723    "protection.getAllowedUsersList": ConferenceProtectionUserList, 
     724    "protection.addAllowedUsers": ConferenceProtectionAddUsers, 
     725    "protection.removeAllowedUser": ConferenceProtectionRemoveUser 
    673726    } 
  • indico/MaKaC/services/implementation/contribution.py

    r9033fd ra89f94  
    44from MaKaC.services.implementation.roomBooking import GetBookingBase 
    55 
    6 from MaKaC.services.interface.rpc.common import ServiceError 
     6from MaKaC.services.interface.rpc.common import ServiceError, ServiceAccessError 
    77 
    88from MaKaC.common.PickleJar import DictPickler 
     
    1212from MaKaC.services.implementation.base import HTMLModificationBase 
    1313from MaKaC.services.implementation.base import DateTimeModificationBase 
     14from MaKaC.common.fossilize import fossilize 
     15from MaKaC.user import PrincipalHolder, Avatar, Group 
    1416 
    1517class ContributionBase(object): 
    1618 
    17     def _checkParams( self ):         
     19    def _checkParams( self ): 
    1820        try: 
    19             self._conf = conference.ConferenceHolder().getById(self._params["conference"]); 
    20             if self._conf == None: 
    21                 raise Exception("Conference id not specified.")         
    22         except:            
    23             raise ServiceError("ERR-E4", "Invalid conference id.") 
     21            self._target = self._conf = conference.ConferenceHolder().getById(self._params["conference"]); 
     22        except: 
     23            try: 
     24                self._target = self._conf = conference.ConferenceHolder().getById(self._params["confId"]); 
     25            except: 
     26                raise ServiceError("ERR-E4", "Invalid conference id.") 
     27 
     28        if self._conf == None: 
     29            raise Exception("Conference id not specified.") 
    2430 
    2531        try: 
    2632            self._target = self._contribution = self._conf.getContributionById(self._params["contribution"]) 
    27             if self._target == None: 
    28                 raise Exception("Contribution id not specified.")         
    29         except:            
    30             raise ServiceError("ERR-C0", "Invalid contribution id.") 
     33        except: 
     34            try: 
     35                self._target = self._contribution = self._conf.getContributionById(self._params["contribId"]) 
     36            except: 
     37                raise ServiceError("ERR-C0", "Invalid contribution id.") 
     38 
     39        if self._target == None: 
     40            raise Exception("Contribution id not specified.") 
    3141 
    3242        # create a parameter manager that checks the consistency of passed parameters 
     
    3444 
    3545class ContributionDisplayBase(ProtectedDisplayService, ContributionBase): 
    36      
     46 
    3747    def _checkParams(self): 
    3848        ContributionBase._checkParams(self) 
     
    4050 
    4151class ContributionModifBase(ContributionBase, ProtectedModificationService): 
    42      
     52 
    4353    def _checkProtection(self): 
    4454        if self._target.getSession() != None: 
     
    4656                return 
    4757        ProtectedModificationService._checkProtection(self) 
    48          
     58 
    4959class ContributionTextModificationBase(TextModificationBase, ContributionBase): 
    5060    pass 
     
    5969    def _checkParams(self): 
    6070        ContributionModifBase._checkParams(self) 
    61          
     71 
    6272        subcId = self._params.get('subContribution',None) 
    63          
    64         self._subCont = self._target.getSubContributionById(subcId)  
    65              
     73 
     74        self._subCont = self._target.getSubContributionById(subcId) 
     75 
    6676        ProtectedModificationService._checkProtection(self) 
    67      
     77 
    6878    def _getAnswer(self): 
    6979        self._subCont.getOwner().removeSubContribution(self._subCont) 
     
    7282    def _checkParams(self): 
    7383        ContributionModifBase._checkParams(self) 
    74          
     84 
    7585        # "presenters" and "keywords" are not required. they can be empty 
    7686        self._presenters = self._pm.extract("presenters", pType=list, allowEmpty=True) 
    7787        self._keywords = self._pm.extract("keywords", pType=list, allowEmpty=True) 
    7888        self._description = self._pm.extract("description", pType=str, allowEmpty=True, defaultValue="") 
    79          
    80         # these are required         
     89 
     90        # these are required 
    8191        self._duration = self._pm.extract("duration", pType=int) 
    8292        self._title = self._pm.extract("title", pType=str) 
    83          
     93 
    8494    def __addPresenters(self, subcontrib): 
    85          
     95 
    8696        # add each presenter 
    8797        for presenterValues in self._presenters: 
    88              
    89             # magically update a new ContributionParticipation with JSON data, using the DictPickler             
     98 
     99            # magically update a new ContributionParticipation with JSON data, using the DictPickler 
    90100            presenter = conference.SubContribParticipation() 
    91101            DictPickler.update(presenter, presenterValues) 
    92102 
    93103            subcontrib.newSpeaker(presenter) 
    94          
     104 
    95105    def _getAnswer(self): 
    96106        # create the sub contribution 
    97107        sc = self._target.newSubContribution() 
    98          
     108 
    99109        sc.setTitle( self._title ) 
    100110        sc.setDescription( self._description ) 
     
    102112        sc.setKeywords('\n'.join(self._keywords)) 
    103113        sc.setDuration( self._duration / 60, \ 
    104                          self._duration % 60 )    
    105                  
     114                         self._duration % 60 ) 
     115 
    106116        self.__addPresenters(sc) 
    107          
     117 
    108118        # log the event 
    109119        logInfo = sc.getLogInfo() 
     
    111121        self._target.getConference().getLogHandler().logAction(logInfo, "Timetable/SubContribution", self._getUser()) 
    112122 
    113 #TODO: this class is duplicated. check if the good one is the one before or this one!                 
     123#TODO: this class is duplicated. check if the good one is the one before or this one! 
    114124class ContributionDeleteSubContribution(ContributionModifBase): 
    115125 
     
    123133        'return': None 
    124134        } 
    125      
     135 
    126136    def _checkParams(self): 
    127137        ContributionModifBase._checkParams(self) 
    128          
     138 
    129139        subContId = self._pm.extract("subcontribution", pType=str, allowEmpty=False) 
    130140 
    131141        self._subContribution = self._contribution.getSubContributionById(subContId) 
    132          
     142 
    133143    def _getAnswer(self): 
    134144        self._subContribution.getOwner().removeSubContribution(self._subContribution) 
     
    137147    pass 
    138148 
     149class ContributionProtectionUserList(ContributionModifBase): 
     150 
     151    def _getAnswer(self): 
     152        #will use IAvatarFossil or IGroupFossil 
     153        return fossilize(self._contribution.getAllowedToAccessList()) 
     154 
     155class ContributionProtectionAddUsers(ContributionModifBase): 
     156 
     157    def _checkParams(self): 
     158        ContributionModifBase._checkParams(self) 
     159 
     160        self._usersData = self._params['value'] 
     161        self._user = self.getAW().getUser() 
     162 
     163    def _getAnswer(self): 
     164 
     165        for user in self._usersData : 
     166 
     167            userToAdd = PrincipalHolder().getById(user['id']) 
     168 
     169            if not userToAdd : 
     170                raise ServiceError("ERR-U0","User does not exist!") 
     171 
     172            self._contribution.grantAccess(userToAdd) 
     173 
     174class ContributionProtectionRemoveUser(ContributionModifBase): 
     175 
     176    def _checkParams(self): 
     177        ContributionModifBase._checkParams(self) 
     178 
     179        self._userData = self._params['value'] 
     180 
     181        self._user = self.getAW().getUser() 
     182 
     183    def _getAnswer(self): 
     184 
     185        userToRemove = PrincipalHolder().getById(self._userData['id']) 
     186 
     187        if not userToRemove : 
     188            raise ServiceError("ERR-U0","User does not exist!") 
     189        elif isinstance(userToRemove, Avatar) or isinstance(userToRemove, Group) : 
     190            self._contribution.revokeAccess(userToRemove) 
     191 
    139192methodMap = { 
    140193    "addSubContribution": ContributionAddSubContribution, 
    141194    "deleteSubContribution": ContributionDeleteSubContribution, 
    142     "getBooking": ContributionGetBooking 
     195    "getBooking": ContributionGetBooking, 
     196    "protection.getAllowedUsersList": ContributionProtectionUserList, 
     197    "protection.addAllowedUsers": ContributionProtectionAddUsers, 
     198    "protection.removeAllowedUser": ContributionProtectionRemoveUser 
    143199} 
  • indico/MaKaC/services/implementation/session.py

    r68f9a3 ra89f94  
    99import MaKaC.conference as conference 
    1010from MaKaC.common.PickleJar import DictPickler 
    11 from MaKaC.services.interface.rpc.common import ServiceError 
     11from MaKaC.services.interface.rpc.common import ServiceError, ServiceAccessError 
    1212from MaKaC.services.implementation import conference as conferenceServices 
    1313import MaKaC.webinterface.locators as locators 
    1414from MaKaC.conference import SessionSlot 
     15from MaKaC.common.fossilize import fossilize 
     16from MaKaC.user import PrincipalHolder, Avatar, Group 
    1517 
    1618class SessionBase(conferenceServices.ConferenceBase): 
     
    155157    pass 
    156158 
     159class SessionProtectionUserList(SessionModifBase): 
     160    def _getAnswer(self): 
     161        #will use IAvatarFossil or IGroupFossil 
     162        return fossilize(self._session.getAllowedToAccessList()) 
     163 
     164class SessionProtectionAddUsers(SessionModifBase): 
     165 
     166    def _checkParams(self): 
     167        SessionModifBase._checkParams(self) 
     168 
     169        self._usersData = self._params['value'] 
     170        self._user = self.getAW().getUser() 
     171 
     172    def _getAnswer(self): 
     173 
     174        for user in self._usersData : 
     175 
     176            userToAdd = PrincipalHolder().getById(user['id']) 
     177 
     178            if not userToAdd : 
     179                raise ServiceError("ERR-U0","User does not exist!") 
     180 
     181            self._session.grantAccess(userToAdd) 
     182 
     183class SessionProtectionRemoveUser(SessionModifBase): 
     184 
     185    def _checkParams(self): 
     186        SessionModifBase._checkParams(self) 
     187 
     188        self._userData = self._params['value'] 
     189 
     190        self._user = self.getAW().getUser() 
     191 
     192    def _getAnswer(self): 
     193 
     194        userToRemove = PrincipalHolder().getById(self._userData['id']) 
     195 
     196        if not userToRemove : 
     197            raise ServiceError("ERR-U0","User does not exist!") 
     198        elif isinstance(userToRemove, Avatar) or isinstance(userToRemove, Group) : 
     199            self._session.revokeAccess(userToRemove) 
     200 
    157201methodMap = { 
    158     "getBooking": SessionGetBooking 
     202    "getBooking": SessionGetBooking, 
     203    "protection.getAllowedUsersList": SessionProtectionUserList, 
     204    "protection.addAllowedUsers": SessionProtectionAddUsers, 
     205    "protection.removeAllowedUser": SessionProtectionRemoveUser 
    159206} 
  • indico/MaKaC/webinterface/pages/category.py

    r645187 ra89f94  
    18851885    def getVars( self ): 
    18861886        vars = wcomponents.WTemplated.getVars( self ) 
     1887 
    18871888        vars["modifyControlFrame"] = wcomponents.WModificationControlFrame().getHTML(\ 
    18881889                                                    self._categ,\ 
    18891890                                                    vars["addManagersURL"],\ 
    18901891                                                    vars["removeManagersURL"] ) 
     1892        if self._categ.isRoot() : 
     1893            type = 'Home' 
     1894        else : 
     1895            type = 'Category' 
     1896 
    18911897        vars["accessControlFrame"] = wcomponents.WAccessControlFrame().getHTML(\ 
    18921898                                                    self._categ,\ 
    18931899                                                    vars["setVisibilityURL"],\ 
    1894                                                     vars["addAllowedURL"],\ 
    1895                                                     vars["removeAllowedURL"] ) 
     1900                                                    type) 
    18961901        if not self._categ.isProtected(): 
    18971902            df =  wcomponents.WDomainControlFrame( self._categ ) 
  • indico/MaKaC/webinterface/pages/conferences.py

    rd66a94c ra89f94  
    37473747        ac = wcomponents.WConfAccessControlFrame().getHTML( self.__conf,\ 
    37483748                                            params["setVisibilityURL"],\ 
    3749                                             params["addAllowedURL"],\ 
    3750                                             params["removeAllowedURL"],\ 
    37513749                                            params["setAccessKeyURL"] ) 
    37523750        dc = "" 
  • indico/MaKaC/webinterface/pages/contributions.py

    r352fcc ra89f94  
    989989        acf=wcomponents.WAccessControlFrame() 
    990990        visURL=urlHandlers.UHContributionSetVisibility.getURL() 
    991         addAlwURL=urlHandlers.UHContributionSelectAllowed.getURL() 
    992         remAlwURL=urlHandlers.UHContributionRemoveAllowed.getURL() 
    993         vars["accessControlFrame"]=acf.getHTML(self._contrib,visURL,addAlwURL,remAlwURL) 
     991 
     992        if isinstance(self._contrib.getOwner(), conference.Session): 
     993            vars["accessControlFrame"]=acf.getHTML(self._contrib, visURL, "InSessionContribution") 
     994        else : 
     995            vars["accessControlFrame"]=acf.getHTML(self._contrib, visURL, "Contribution") 
     996 
    994997        if not self._contrib.isProtected(): 
    995998            df=wcomponents.WDomainControlFrame( self._contrib ) 
  • indico/MaKaC/webinterface/pages/sessions.py

    rd66a94c ra89f94  
    20242024        wc=wcomponents.WAccessControlFrame() 
    20252025        vars["accessControlFrame"]=wc.getHTML(self._session,\ 
    2026                                 urlHandlers.UHSessionSetVisibility.getURL(),\ 
    2027                                 urlHandlers.UHSessionSelectAllowed.getURL(),\ 
    2028                                 urlHandlers.UHSessionRemoveAllowed.getURL()) 
     2026                                urlHandlers.UHSessionSetVisibility.getURL(), 
     2027                                "Session") 
    20292028        if not self._session.isProtected(): 
    20302029            df=wcomponents.WDomainControlFrame(self._session) 
  • indico/MaKaC/webinterface/rh/categoryMod.py

    r701dc2 ra89f94  
    601601        if params["visibility"] == "PRIVATE": 
    602602            self._target.setProtection( 1 ) 
     603        elif params["visibility"] == "INHERITING": 
     604            self._target.setProtection( 0 ) 
    603605        elif params["visibility"] == "PUBLIC": 
    604             self._target.setProtection( 0 ) 
    605         elif params["visibility"] == "ABSOLUTELY PUBLIC": 
    606             self._target.setProtection( -1 ) 
     606            # The 'Home' category is handled as a special case. 
     607            # We maintain the illusion for the user of it being either 
     608            # private or public, but actually it can be either private 
     609            # or inheriting for legacy reasons. 
     610            if params["type"] == "Home": 
     611                self._target.setProtection( 0 ) 
     612            else : 
     613                self._target.setProtection( -1 ) 
    607614        self._redirect( urlHandlers.UHCategModifAC.getURL( self._target ) ) 
    608615 
  • indico/MaKaC/webinterface/rh/conferenceModif.py

    r20f609 ra89f94  
    16961696        if params["visibility"] == "PRIVATE": 
    16971697            self._protectConference = 1 
     1698        elif params["visibility"] == "INHERITING": 
     1699            self._protectConference = 0 
    16981700        elif params["visibility"] == "PUBLIC": 
    1699             self._protectConference = 0 
    1700         elif params["visibility"] == "ABSOLUTELY PUBLIC": 
    17011701            self._protectConference = -1 
    17021702 
  • indico/MaKaC/webinterface/rh/contribMod.py

    r6509a2 ra89f94  
    14301430    def _process(self): 
    14311431        params = self._getRequestParams() 
    1432         privacy = params.get("visibility","PUBLIC") 
     1432        privacy = params.get("visibility","INHERITING") 
    14331433        self._protect = 0 
    14341434        if privacy == "PRIVATE": 
    14351435            self._protect = 1 
     1436        elif privacy == "INHERITING": 
     1437            self._protect = 0 
    14361438        elif privacy == "PUBLIC": 
    1437             self._protect = 0 
    1438         elif privacy == "ABSOLUTELY PUBLIC": 
    14391439            self._protect = -1 
    14401440        self._target.setProtection(self._protect) 
  • indico/MaKaC/webinterface/rh/sessionModif.py

    r6b4ff5 ra89f94  
    11761176    def _checkParams( self, params ): 
    11771177        RHSessionModifBase._checkParams( self, params ) 
    1178         privacy = params.get("visibility","PUBLIC") 
     1178        privacy = params.get("visibility","INHERITING") 
    11791179        self._protect = 0 
    11801180        if privacy == "PRIVATE": 
    11811181            self._protect = 1 
     1182        elif privacy == "INHERITING": 
     1183            self._protect = 0 
    11821184        elif privacy == "PUBLIC": 
    1183             self._protect = 0 
    1184         elif privacy == "ABSOLUTELY PUBLIC": 
    11851185            self._protect = -1 
    11861186 
  • indico/MaKaC/webinterface/tpls/AccessControlFrame.tpl

    r9033fd ra89f94  
     1<%! 
     2#Special case for categories 
     3if isFullyPublic == None : 
     4    isFullyPublic = True 
     5 
     6%> 
    17 
    28<table class="groupTable"> 
     
    410  <td colspan="5"><div class="groupTitle"><%= _("Access control")%></div></td> 
    511</tr> 
    6 <tr> 
    7   <td nowrap class="dataCaptionTD"><span class="dataCaptionFormat"><%= _("Current status")%></span></td> 
    8   <td class="blacktext"> 
    9     <form action="%(setVisibilityURL)s" method="POST"> 
    10     %(locator)s 
    11     <b>%(privacy)s</b><br/> 
    12     <small> 
    13     %(changePrivacy)s 
    14     </small> 
    15     </form> 
    16   </td> 
    17 </tr> 
    18 <tr> 
    19   <td nowrap class="dataCaptionTD"><span class="dataCaptionFormat"><%= _("Users allowed to access")%></span></td> 
    20   <td class="blacktext">%(userTable)s</td> 
    21 </tr> 
     12<% if type == 'Home' : %> 
     13<% includeTpl('HomeAccessControlStatusFrame', setPrivacyURL=setPrivacyURL, privacy=privacy, locator = locator) %> 
     14<% end %> 
     15<% else : %> 
     16<% includeTpl('AccessControlStatusFrame', parentName=parentName, privacy=privacy, \ 
     17    parentPrivacy=parentPrivacy, statusColor = statusColor, parentStatusColor=parentStatusColor, 
     18    locator=locator, isFullyPublic=isFullyPublic) %> 
     19<% end %> 
    2220</table> 
    2321 
  • indico/MaKaC/webinterface/tpls/ConfAccessControlFrame.tpl

    r9033fd ra89f94  
    55    </tr> 
    66    <tr> 
    7         <td nowrap class="titleCellTD"><span class="titleCellFormat"> <%= _("Current status")%></span></td> 
    8                 <form action="%(setPrivacyURL)s" method="POST"> 
    9         <td bgcolor="white" width="100%%" valign="top" class="blacktext"> 
    10             %(locator)s 
    11     <b>%(privacy)s</b><br/> 
    12     <small> 
    13     %(changePrivacy)s 
    14     </small> 
    15         </td> 
    16                 </form> 
     7        <td colspan="5" style="height: 10px"></td> 
    178    </tr> 
    18     <tr> 
    19         <td nowrap class="titleCellTD"><span class="titleCellFormat"><%= _("Users allowed to access")%></span></td> 
    20         <td bgcolor="white" width="100%%" valign="top" class="blueLineBottom">%(userTable)s</td> 
    21     </tr> 
     9<% includeTpl('AccessControlStatusFrame', parentName=parentName, privacy=privacy, \ 
     10    parentPrivacy=parentPrivacy, statusColor = statusColor, parentStatusColor=parentStatusColor,\ 
     11    locator=locator, isFullyPublic=isFullyPublic) %> 
    2212    <tr> 
    2313        <td class="titleCellTD"><span class="titleCellFormat"><%= _("Access key")%></span></td> 
    24         <td bgcolor="white" width="100%%" valign="top" class="blacktext"> 
    25                 <form action="%(setAccessKeyURL)s" method="POST"> 
    26                 %(locator)s 
    27                 <input name="accessKey" type="password" size=25 value="%(accessKey)s"> 
    28                 <input type="submit" class="btn" value="<%= _("change")%>"> 
    29                 </form> 
    30         </td> 
     14            <td bgcolor="white" width="100%%" valign="top" class="blacktext"> 
     15                <form action="%(setAccessKeyURL)s" method="POST"> 
     16                        %(locator)s 
     17                <input name="accessKey" type="password" size=25 value="%(accessKey)s"> 
     18                <input type="submit" class="btn" value="<%= _("change")%>"> 
     19                </form> 
     20            </td> 
    3121    </tr> 
    3222</table> 
  • indico/MaKaC/webinterface/wcomponents.py

    r352fcc ra89f94  
    18221822class WAccessControlFrame(WTemplated): 
    18231823 
    1824     def getHTML( self, target, setVisibilityURL, addAllowedURL, removeAllowedURL): 
     1824    def getHTML( self, target, setVisibilityURL, type ): 
    18251825        self.__target = target 
    1826         params = { "setVisibilityURL": setVisibilityURL,\ 
    1827                    "addAllowedURL": addAllowedURL, \ 
    1828                    "removeAllowedURL": removeAllowedURL } 
     1826 
     1827        params = { "setPrivacyURL": setVisibilityURL,\ 
     1828                   "target": target,\ 
     1829                   "type": type } 
    18291830        return  WTemplated.getHTML( self, params ) 
    18301831 
    18311832    def getVars( self ): 
    18321833        vars = WTemplated.getVars( self ) 
     1834 
    18331835        if self.__target.getAccessProtectionLevel() == -1: 
    1834             vars["privacy"] = "ABSOLUTELY PUBLIC%s" % WInlineContextHelp('The object will stay public regardless of the protection of its parent (no more inheritance)').getHTML() 
    1835             vars["changePrivacy"] = """make it simply <input type="submit" class="btn" name="visibility" value="PUBLIC">%s<br/>""" % WInlineContextHelp('It will then be public by default but will inherit from the potential protection of its parent').getHTML() 
    1836             vars["changePrivacy"] += """make it <input type="submit" class="btn" name="visibility" value="PRIVATE"> by itself%s<br/>""" % WInlineContextHelp('It will then be private').getHTML() 
     1836            vars["privacy"] = "PUBLIC" 
     1837            vars["statusColor"] = "#128F33" 
    18371838        elif self.__target.isItselfProtected(): 
    1838             vars["privacy"] = "PRIVATE%s" % WInlineContextHelp('The object is private by itself').getHTML() 
    1839             vars["changePrivacy"] = """make it simply <input type="submit" class="btn" name="visibility" value="PUBLIC">%s<br/>""" % WInlineContextHelp('It will then be public by default but will inherit from the potential protection of its parent').getHTML() 
    1840             vars["changePrivacy"] += """make it <input type="submit" class="btn" name="visibility" value="ABSOLUTELY PUBLIC">%s""" % WInlineContextHelp('The object will stay public regardless of the protection of its parent').getHTML() 
    1841         elif self.__target.hasProtectedOwner(): 
    1842             vars["privacy"] = "PRIVATE by inheritance%s" % WInlineContextHelp('Private because a parent object is private').getHTML() 
    1843             vars["changePrivacy"] = """make it <input type="submit" class="btn" name="visibility" value="PRIVATE"> by itself%s<br/>""" % WInlineContextHelp('It will then remain private even if the parent object goes public').getHTML() 
    1844             vars["changePrivacy"] += """make it <input type="submit" class="btn" name="visibility" value="ABSOLUTELY PUBLIC">%s""" % WInlineContextHelp('The object will stay public regardless of the protection of its parent').getHTML() 
    1845         else: 
    1846             vars["privacy"] = "PUBLIC%s" % WInlineContextHelp('the object is currently public because its parent is public but might inherit from the potential protection of its parent if it changes one day').getHTML() 
    1847             vars["changePrivacy"] = """make it <input type="submit" class="btn" name="visibility" value="PRIVATE"> by itself<br/>""" 
    1848             vars["changePrivacy"] += """make it <input type="submit" class="btn" name="visibility" value="ABSOLUTELY PUBLIC">%s""" % WInlineContextHelp('The object will stay public regardless of the protection of its parent').getHTML() 
     1839            vars["privacy"] = "PRIVATE" 
     1840            vars["statusColor"] = "#B02B2C" 
     1841        else : 
     1842            vars["privacy"] = "INHERITING" 
     1843            vars["statusColor"] = "#444444" 
     1844 
     1845        vars["isFullyPublic"] = None 
     1846 
     1847        if not isinstance(self.__target, Category) : 
     1848            vars["isFullyPublic"] = self.__target.isFullyPublic() 
     1849 
     1850        if isinstance(self.__target, Category) and self.__target.isRoot(): 
     1851            vars["parentName"] = vars["parentPrivacy"] = vars["parentStatusColor"] = '' 
     1852        else : 
     1853            vars["parentName"] = self.__target.getOwner().getTitle() 
     1854 
     1855            if self.__target.hasProtectedOwner(): 
     1856                vars["parentPrivacy"] = "PRIVATE" 
     1857                vars["parentStatusColor"] = "#B02B2C" 
     1858            else : 
     1859                vars["parentPrivacy"] = "PUBLIC" 
     1860                vars["parentStatusColor"] = "#128F33" 
     1861 
    18491862        vars["locator"] = self.__target.getLocator().getWebForm() 
    1850         vars["userTable"] = WPrincipalTable().getHTML( self.__target.getAllowedToAccessList(), self.__target, vars["addAllowedURL"], vars["removeAllowedURL"],selectable=False ) 
    18511863 
    18521864        return vars 
     
    18551867class WConfAccessControlFrame(WTemplated): 
    18561868 
    1857     def getHTML( self, target, setVisibilityURL, addAllowedURL, removeAllowedURL,  setAccessKeyURL): 
     1869    def getHTML( self, target, setVisibilityURL, setAccessKeyURL): 
    18581870        self.__target = target 
    1859         params = { "setPrivacyURL": setVisibilityURL,\ 
    1860                    "addAllowedURL": addAllowedURL, \ 
    1861                    "removeAllowedURL": removeAllowedURL, \ 
    1862                     "setAccessKeyURL": setAccessKeyURL } 
     1871        params = { "target": target,\ 
     1872                   "setPrivacyURL": setVisibilityURL,\ 
     1873                   "setAccessKeyURL": setAccessKeyURL,\ 
     1874                   "type": "Event" } 
    18631875        return  WTemplated.getHTML( self, params ) 
    18641876 
    18651877    def getVars( self ): 
    18661878        vars = WTemplated.getVars( self ) 
     1879 
    18671880        if self.__target.getAccessProtectionLevel() == -1: 
    1868             vars["privacy"] = "ABSOLUTELY PUBLIC%s" % WInlineContextHelp('The object will stay public regardless of the protection of its parent (no more inheritance)').getHTML() 
    1869             vars["changePrivacy"] = """make it simply <input type="submit" class="btn" name="visibility" value="PUBLIC">%s<br/>""" % WInlineContextHelp('It will then be public by default but will inherit from the potential protection of its parent').getHTML() 
    1870             vars["changePrivacy"] += """make it <input type="submit" class="btn" name="visibility" value="PRIVATE"> by itself%s<br/>""" % WInlineContextHelp('It will then be private').getHTML() 
     1881            vars["privacy"] = "PUBLIC" 
     1882            vars["statusColor"] = "#128F33" 
    18711883        elif self.__target.isItselfProtected(): 
    1872             vars["privacy"] = "PRIVATE%s" % WInlineContextHelp('The object is private by itself').getHTML() 
    1873             vars["changePrivacy"] = """make it simply <input type="submit" class="btn" name="visibility" value="PUBLIC">%s<br/>""" % WInlineContextHelp('It will then be public by default but will inherit from the potential protection of its parent').getHTML() 
    1874             vars["changePrivacy"] += """make it <input type="submit" class="btn" name="visibility" value="ABSOLUTELY PUBLIC">%s""" % WInlineContextHelp('The object will stay public regardless of the protection of its parent').getHTML() 
    1875         elif self.__target.hasProtectedOwner(): 
    1876             vars["privacy"] = "PRIVATE by inheritance%s" % WInlineContextHelp('Private because a parent object is private').getHTML() 
    1877             vars["changePrivacy"] = """make it <input type="submit" class="btn" name="visibility" value="PRIVATE"> by itself%s<br/>""" % WInlineContextHelp('It will then remain private even if the parent object goes public').getHTML() 
    1878             vars["changePrivacy"] += """make it <input type="submit" class="btn" name="visibility" value="ABSOLUTELY PUBLIC">%s""" % WInlineContextHelp('The object will stay public regardless of the protection of its parent').getHTML() 
    1879         else: 
    1880             if not self.__target.isFullyPublic(): 
    1881                 fullyPublic = " - part of this event is protected" 
    1882             else: 
    1883                 fullyPublic = "" 
    1884             vars["privacy"] = "PUBLIC%s%s" % (WInlineContextHelp('the object is currently public because its parent is public but might inherit from the potential protection of its parent if it changes one day').getHTML(), fullyPublic) 
    1885             vars["changePrivacy"] = """make it <input type="submit" class="btn" name="visibility" value="PRIVATE"> by itself<br/>""" 
    1886             vars["changePrivacy"] += """make it <input type="submit" class="btn" name="visibility" value="ABSOLUTELY PUBLIC">%s""" % WInlineContextHelp('The object will stay public regardless of the protection of its parent').getHTML() 
     1884            vars["privacy"] = "PRIVATE" 
     1885            vars["statusColor"] = "#B02B2C" 
     1886        else : 
     1887            vars["privacy"] = "INHERITING" 
     1888            vars["statusColor"] = "#444444" 
     1889 
     1890        vars["isFullyPublic"] = self.__target.isFullyPublic() 
     1891        vars["parentName"] = self.__target.getOwner().getName() 
     1892 
     1893        if self.__target.hasProtectedOwner(): 
     1894            vars["parentPrivacy"] = "PRIVATE" 
     1895            vars["parentStatusColor"] = "#B02B2C" 
     1896        else : 
     1897            vars["parentPrivacy"] = "PUBLIC" 
     1898            vars["parentStatusColor"] = "#128F33" 
    18871899 
    18881900        vars["locator"] = self.__target.getLocator().getWebForm() 
    1889         vars["userTable"] = WPrincipalTable().getHTML( self.__target.getAllowedToAccessList(), 
    1890                                                        self.__target, 
    1891                                                        vars["addAllowedURL"], 
    1892                                                        vars["removeAllowedURL"], 
    1893                                                        selectable=False ) 
    18941901        vars["accessKey"] = self.__target.getAccessKey() 
     1902 
    18951903        return vars 
    18961904 
     
    35873595        return tab 
    35883596 
    3589 class WConfModifAC: 
    3590  
    3591     def __init__( self, conference ): 
    3592         self.__conf = conference 
    3593  
    3594     def getHTML( self, params ): 
    3595         ac = WAccessControlFrame().getHTML( self.__conf,\ 
    3596                                             params["setVisibilityURL"],\ 
    3597                                             params["addAllowedURL"],\ 
    3598                                             params["removeAllowedURL"] ) 
    3599         dc = "" 
    3600         if not self.__conf.isProtected(): 
    3601             dc =  "<br>%s"%WDomainControlFrame( self.__conf ).getHTML( \ 
    3602                                                     params["addDomainURL"], \ 
    3603                                                     params["removeDomainURL"] ) 
    3604         mc = WModificationControlFrame().getHTML( self.__conf,\ 
    3605                                                   params["addManagersURL"],\ 
    3606                                                   params["removeManagersURL"] ) 
    3607         return """%s%s<br>%s"""%( ac, dc, mc ) 
    36083597 
    36093598#class WTrackModifSubTrack( WTemplated ): 
  • indico/htdocs/css/Default.css

    rf26b79 ra89f94  
    33053305} 
    33063306 
     3307div.ACModifDiv { 
     3308    color: #333333; 
     3309} 
     3310 
     3311div.ACStatusDiv { 
     3312    font-size: 15px; 
     3313    padding-bottom: 9px; 
     3314} 
     3315 
     3316span.ACStatus { 
     3317    font-weight: bold; 
     3318} 
     3319 
     3320div.ACStatusDescDiv { 
     3321    color: #777777; 
     3322    padding-left: 20px; 
     3323    padding-bottom: 20px; 
     3324    font-style: italic; 
     3325    width: 600px; 
     3326} 
     3327 
     3328div.ACModifButtonsDiv { 
     3329    padding-bottom: 20px; 
     3330    font-size: 12px; 
     3331} 
     3332 
     3333div.ACModifButtonEntry { 
     3334    padding-bottom: 5px; 
     3335} 
     3336 
     3337div.ACUserListDiv { 
     3338    padding-bottom: 20px; 
     3339    padding-left: 35px; 
     3340} 
     3341 
     3342div.ACUserListDiv ul.UIPeopleList { 
     3343    background-color: #FAFAFA; 
     3344    border: 1px solid #999999; 
     3345    min-height: 200px; 
     3346    width: 550px; 
     3347} 
     3348 
    33073349.bannerTitle 
    33083350{ 
Note: See TracChangeset for help on using the changeset viewer.