Ejemplo n.º 1
0
    def site_owner(self, *args, **kw):
        data = dict(kw)
        data['given_kw'] = kw
        filter_dict = {}
        data['facility'] = data.get('facility', None)
        self.focus(kw, data, 'site_owner', 'user', ['user', 'vo', 'both'])

        data['title'] = 'Site owner view for %s' % data['facility']

        #User auth
        self.user_auth(data)
        self.user_roles(data)

        #Handle refine
        self.refine(data, filter_dict, facility=False)

        token = self.start_image_maps()
        #Generate image maps
        if data['focus']['value'] == 'user' or data['focus']['value'] == 'both':
            #self.image_map(token, data, 'GratiaSiteBarQueries', \
            #    'site_user_job_quality', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries',
                           'site_user_job_hours', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries',
                           'site_user_transfer_quality', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries',
                           'site_user_transfer_rate', 'site_owner', 'user')
        if data['focus']['value'] == 'vo' or data['focus']['value'] == 'both':
            self.image_map(token, data, 'GratiaSiteBarQueries',
                           'site_vo_job_quality', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries',
                           'site_vo_job_hours', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries',
                           'site_vo_transfer_quality', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries',
                           'site_vo_transfer_rate', 'site_owner', 'user')
        self.finish_image_maps(token)

        #Empty transfer list for now
        #transfers, metadata = self.globals['GratiaSiteBarQueries'].\
        #    site_table(data['query_kw'])
        transfers = []
        for transfer in transfers:
            transfer['name'] = displayName(transfer['name'])
            transfer['transfer_rate'] = to_mb(transfer['transfer_rate']) + \
                ' MB/s'
            transfer['bytes_transferred'] = to_mb( \
                transfer['bytes_transferred']) + ' MB'
        data['transfers'] = transfers

        # External data
        external = {}
        data['external'] = external
        external['GridScan'] = self.fetch_gridscan(data.get('facility'))[0][:2]
        external['GIP Validator'] = self.gip_validation(
            data['facility'])[0][:2]
        return data
Ejemplo n.º 2
0
    def site_owner(self, *args, **kw):
        data = dict(kw)
        data['given_kw'] = kw
        filter_dict = {}
        data['facility'] = data.get('facility', None)
        self.focus(kw, data, 'site_owner', 'user', ['user', 'vo', 'both'])

        data['title'] = 'Site owner view for %s' % data['facility']

        #User auth
        self.user_auth(data)
        self.user_roles(data)

        #Handle refine
        self.refine(data, filter_dict, facility=False)

        token = self.start_image_maps()
        #Generate image maps
        if data['focus']['value'] == 'user' or data['focus']['value'] == 'both':
            #self.image_map(token, data, 'GratiaSiteBarQueries', \
            #    'site_user_job_quality', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries', 
                'site_user_job_hours', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries', 
                'site_user_transfer_quality', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries', 
                'site_user_transfer_rate', 'site_owner', 'user')
        if data['focus']['value'] == 'vo' or data['focus']['value'] == 'both':
            self.image_map(token, data, 'GratiaSiteBarQueries', 
                 'site_vo_job_quality', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries', 
                 'site_vo_job_hours', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries', 
                'site_vo_transfer_quality', 'site_owner', 'user')
            self.image_map(token, data, 'GratiaSiteBarQueries', 
                'site_vo_transfer_rate', 'site_owner', 'user')
        self.finish_image_maps(token)

        #Empty transfer list for now
        #transfers, metadata = self.globals['GratiaSiteBarQueries'].\
        #    site_table(data['query_kw'])
        transfers = []
        for transfer in transfers:
            transfer['name'] = displayName(transfer['name'])
            transfer['transfer_rate'] = to_mb(transfer['transfer_rate']) + \
                ' MB/s'
            transfer['bytes_transferred'] = to_mb( \
                transfer['bytes_transferred']) + ' MB'
        data['transfers'] = transfers

        # External data
        external = {}
        data['external'] = external
        external['GridScan'] = self.fetch_gridscan(data.get('facility'))[0][:2]
        external['GIP Validator'] = self.gip_validation(data['facility'])[0][:2]
        return data
 def user_auth(self, data):
     dn = cherrypy.request.headers.get('SSL-CLIENT-S-DN', None)
     if dn:
         assert cherrypy.request.headers.get('SSL-CLIENT-VERIFY', \
               'Failure') == 'SUCCESS'
         data['is_authenticated'] = True
         data['dn'] = dn
         data['name'] = displayName(dn)
     else:
         data['is_authenticated'] = False
Ejemplo n.º 4
0
 def user_auth(self, data):
     dn = cherrypy.request.headers.get('SSL-CLIENT-S-DN',None)
     if dn:
         assert cherrypy.request.headers.get('SSL-CLIENT-VERIFY', \
               'Failure') == 'SUCCESS'
         data['is_authenticated'] = True
         data['dn'] = dn
         data['name'] = displayName(dn)
     else:
         data['is_authenticated'] = False