web/views/euser.py
branchtls-sprint
changeset 728 a95b284150d1
parent 692 800592b8d39b
child 753 17d38f000bea
equal deleted inserted replaced
727:30fe8f5afbd8 728:a95b284150d1
    17 from cubicweb.web.views.baseviews import PrimaryView, EntityView
    17 from cubicweb.web.views.baseviews import PrimaryView, EntityView
    18 
    18 
    19 
    19 
    20 class UserPreferencesEntityAction(Action):
    20 class UserPreferencesEntityAction(Action):
    21     id = 'prefs'
    21     id = 'prefs'
    22     __selectors__ = (one_line_rset, implements('EUser'),
    22     __select__ = (one_line_rset & implements('EUser') &
    23                      match_user_groups('owners', 'managers'))
    23                   match_user_groups('owners', 'managers'))
    24     
    24     
    25     title = _('preferences')
    25     title = _('preferences')
    26     category = 'mainactions'
    26     category = 'mainactions'
    27     
    27     
    28     def url(self):
    28     def url(self):
    29         login = self.rset.get_entity(self.row or 0, self.col or 0).login
    29         login = self.rset.get_entity(self.row or 0, self.col or 0).login
    30         return self.build_url('euser/%s'%login, vid='epropertiesform')
    30         return self.build_url('euser/%s'%login, vid='epropertiesform')
    31 
    31 
    32 
    32 
    33 class EUserPrimaryView(PrimaryView):
    33 class EUserPrimaryView(PrimaryView):
    34     __selectors__ = implements('EUser')
    34     __select__ = implements('EUser')
    35     
    35     
    36     skip_attrs = ('firstname', 'surname')
    36     skip_attrs = ('firstname', 'surname')
    37     
    37     
    38     def iter_relations(self, entity):
    38     def iter_relations(self, entity):
    39         # don't want to display user's entities
    39         # don't want to display user's entities
    49         return  rschema.type in ['interested_in', 'tags', 
    49         return  rschema.type in ['interested_in', 'tags', 
    50                                  'todo_by', 'bookmarked_by',
    50                                  'todo_by', 'bookmarked_by',
    51                                  ]
    51                                  ]
    52 class FoafView(EntityView):
    52 class FoafView(EntityView):
    53     id = 'foaf'
    53     id = 'foaf'
    54     __selectors__ = implements('EUser')
    54     __select__ = implements('EUser')
    55     
    55     
    56     title = _('foaf')
    56     title = _('foaf')
    57     templatable = False
    57     templatable = False
    58     content_type = 'text/xml'
    58     content_type = 'text/xml'
    59 
    59 
    95             
    95             
    96 class EditGroups(EntityForm):
    96 class EditGroups(EntityForm):
    97     """displays a simple euser / egroups editable table"""
    97     """displays a simple euser / egroups editable table"""
    98     
    98     
    99     id = 'editgroups'
    99     id = 'editgroups'
   100     __selectors__ = implements('EUser')
   100     __select__ = implements('EUser')
   101     
   101     
   102     def call(self):
   102     def call(self):
   103         self.req.add_css('cubicweb.acl.css')            
   103         self.req.add_css('cubicweb.acl.css')            
   104         _ = self.req._
   104         _ = self.req._
   105         self.w(u'<form id="editgroup" method="post" action="edit">')
   105         self.w(u'<form id="editgroup" method="post" action="edit">')