Changeset 11958 for main/waeup.kofa/branches/henrik-regista/src/waeup
- Timestamp:
- 14 Nov 2014, 22:32:42 (10 years ago)
- Location:
- main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba
- Files:
-
- 20 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/interfaces.py
r11954 r11958 184 184 constraint=validate_email, 185 185 ) 186 187 class ICustomerNavigationBase(IIkobaObject): 188 """Objects that provide customer navigation should 189 implement this interface. 190 """ 191 customer = Attribute('''Some customer object that has a ''' 192 ''' `display_fullname` attribute.''') -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/browser/layout.py
r11954 r11958 36 36 from waeup.ikoba.utils.helpers import to_timezone 37 37 from waeup.ikoba.authentication import get_principal_role_manager 38 from waeup.ikoba.browser.interfaces import ICustomerNavigationBase 38 39 39 40 grok.templatedir('templates') … … 258 259 return self.request.principal.user_type == 'customer' 259 260 261 def getCustomerName(self): 262 """Return the customer name. 263 """ 264 if ICustomerNavigationBase.providedBy(self.context): 265 return self.context.customer.display_fullname 266 260 267 def formatDatetime(self,datetimeobj): 261 268 if isinstance(datetimeobj, datetime): -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/customers/interfaces.py
r11956 r11958 22 22 from zc.sourcefactory.contextual import BasicContextualSourceFactory 23 23 from waeup.ikoba.interfaces import MessageFactory as _ 24 from waeup.ikoba.interfaces import ( 25 IIkobaObject, application_sessions_vocab, validate_email, ICSVExporter) 24 26 from waeup.ikoba.schema import TextLineChoice, FormattedDate, PhoneNumber 25 from waeup.ikoba.interfaces import IIkobaObject 27 from waeup.ikoba.browser.interfaces import ICustomerNavigationBase 28 29 from waeup.ikoba.customers.vocabularies import ( 30 contextual_reg_num_source, GenderSource, nats_vocab) 26 31 27 32 class ICustomersUtils(Interface): … … 71 76 unique_customer_id = Attribute("""A unique customer id.""") 72 77 78 79 class ICustomerNavigation(ICustomerNavigationBase): 80 """Interface needed for custom navigation, logging, etc. 81 82 """ 83 customer = Attribute('Customer object of context.') 84 85 def writeLogMessage(view, message): 86 """Write a view specific log message into custom.log. 87 88 """ 89 73 90 class ICustomer(IIkobaObject): 74 91 """Representation of a customer. … … 76 93 """ 77 94 95 history = Attribute('Object history, a list of messages') 96 state = Attribute('Returns the registration state of a customer') 97 password = Attribute('Encrypted password of a customer') 98 temp_password = Attribute( 99 'Dictionary with user name, timestamp and encrypted password') 100 fullname = Attribute('All name parts separated by hyphens') 101 display_fullname = Attribute('The fullname of an applicant') 102 103 suspended = schema.Bool( 104 title = _(u'Account suspended'), 105 default = False, 106 required = False, 107 ) 108 109 suspended_comment = schema.Text( 110 title = _(u"Reasons for Deactivation"), 111 required = False, 112 description = _( 113 u'This message will be shown if and only if deactivated ' 114 'customers try to login.'), 115 ) 116 117 customer_id = schema.TextLine( 118 title = _(u'Student Id'), 119 required = False, 120 ) 121 122 firstname = schema.TextLine( 123 title = _(u'First Name'), 124 required = True, 125 ) 126 127 middlename = schema.TextLine( 128 title = _(u'Middle Name'), 129 required = False, 130 ) 131 132 lastname = schema.TextLine( 133 title = _(u'Last Name (Surname)'), 134 required = True, 135 ) 136 137 sex = schema.Choice( 138 title = _(u'Sex'), 139 source = GenderSource(), 140 required = True, 141 ) 142 143 reg_number = TextLineChoice( 144 title = _(u'Registration Number'), 145 required = True, 146 readonly = False, 147 source = contextual_reg_num_source, 148 ) 149 150 email = schema.ASCIILine( 151 title = _(u'Email'), 152 required = False, 153 constraint=validate_email, 154 ) 155 phone = PhoneNumber( 156 title = _(u'Phone'), 157 description = u'', 158 required = False, 159 ) 160 161 def setTempPassword(user, password): 162 """Set a temporary password (LDAP-compatible) SSHA encoded for 163 officers. 164 165 """ 166 167 def getTempPassword(): 168 """Check if a temporary password has been set and if it 169 is not expired. 170 171 Return the temporary password if valid, 172 None otherwise. Unset the temporary password if expired. 173 """ 174 175 class ICustomerUpdateByRegNo(ICustomer): 176 """Representation of a customer. Skip regular reg_number validation. 177 178 """ 179 reg_number = schema.TextLine( 180 title = _(u'Registration Number'), 181 required = False, 182 ) 183 184 class ICSVCustomerExporter(ICSVExporter): 185 """A regular ICSVExporter that additionally supports exporting 186 data from a given customer object. 187 """ 188 def get_filtered(site, **kw): 189 """Get a filtered set of customer. 190 """ 191 192 def export_student(student, filepath=None): 193 """Export data for a given customer. 194 """ 195 196 def export_filtered(site, filepath=None, **kw): 197 """Export filtered set of customers. 198 """ 199 -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/interfaces.py
r11954 r11958 101 101 (_('courses validated'), VALIDATED), 102 102 (_('returning'), RETURNING), 103 (_('graduated'), GRADUATED),104 (_('transcript requested'), TRANSCRIPT),105 103 ) 106 104 -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/permissions.py
r11949 r11958 156 156 'waeup.manageReports', 157 157 'waeup.manageJobs', 158 'waeup.viewCustomer', 'waeup.viewCustomers', 159 'waeup.manageCustomer', 'waeup.viewCustomersContainer', 160 'waeup.payCustomer', 'waeup.uploadCustomerFile', 161 'waeup.viewCustomersTab' 158 162 ) 159 163 … … 177 181 'waeup.manageReports', 178 182 #'waeup.manageJobs', 183 'waeup.viewCustomer', 'waeup.viewCustomers', 184 'waeup.manageCustomer', 'waeup.viewCustomersContainer', 185 'waeup.payCustomer', 'waeup.uploadCustomerFile', 186 'waeup.viewCustomersTab' 179 187 ) 180 188 -
main/waeup.kofa/branches/henrik-regista/src/waeup/ikoba/permissions.txt
r11949 r11958 29 29 30 30 >>> sorted(list(get_all_roles())) 31 [(u'waeup. DataCenterManager', <waeup.ikoba.permissions.DataCenterManagerobject at 0x...]31 [(u'waeup.Customer', <waeup.ikoba.customers.permissions.CustomerRole object at 0x...] 32 32 33 33 :func:`get_waeup_roles` … … 39 39 >>> from waeup.ikoba.permissions import get_waeup_roles 40 40 >>> len(list(get_waeup_roles())) 41 941 13 42 42 43 43 >>> len(list(get_waeup_roles(also_local=True))) 44 1 044 15 45 45 46 46 … … 53 53 >>> from waeup.ikoba.permissions import get_waeup_role_names 54 54 >>> list(get_waeup_role_names()) 55 [u'waeup.DataCenterManager', 55 [u'waeup.Customer', 56 u'waeup.CustomerImpersonator', 57 u'waeup.CustomersManager', 58 u'waeup.CustomersOfficer', 59 u'waeup.DataCenterManager', 56 60 u'waeup.ExportManager', 57 61 u'waeup.ImportManager',
Note: See TracChangeset for help on using the changeset viewer.