Index: main/waeup.uniben/trunk/src/waeup/uniben/permissions.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/permissions.py	(revision 15370)
+++ main/waeup.uniben/trunk/src/waeup/uniben/permissions.py	(revision 15371)
@@ -23,5 +23,5 @@
 
 class ClearLibrary(grok.Permission):
-    grok.name('waeup.clearForLibrary')
+    grok.name('waeup.switchLibraryAccess')
 
 class PassportPictureManager(grok.Role):
@@ -37,5 +37,5 @@
     grok.permissions('waeup.showStudents',
                      'waeup.viewAcademics',
-                     'waeup.clearForLibrary')
+                     'waeup.switchLibraryAccess')
 
 class CRPUOfficer(CCOfficer):
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py	(revision 15370)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py	(revision 15371)
@@ -52,5 +52,6 @@
     NigeriaStudentPersonalManageFormPage,
     NigeriaStudentPersonalEditFormPage,
-    NigeriaAccommodationManageFormPage
+    NigeriaAccommodationManageFormPage,
+    NigeriaStudentBaseDisplayFormPage,
     )
 
@@ -66,4 +67,20 @@
     ICustomStudentPersonalEdit)
 from waeup.uniben.interfaces import MessageFactory as _
+
+class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage):
+    """ Page to display student base data
+    """
+    form_fields = grok.AutoFields(ICustomStudentBase).omit(
+        'password', 'suspended', 'suspended_comment',
+        'flash_notice', 'provisionally_cleared')
+    form_fields[
+        'financial_clearance_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
+
+#class CustomStudentBaseManageFormPage(NigeriaStudentBaseManageFormPage):
+#    """ View to manage student base data
+#    """
+#    form_fields = grok.AutoFields(ICustomStudentBase).omit(
+#        'student_id', 'adm_code', 'suspended',
+#        'financially_cleared_by', 'financial_clearance_date')
 
 class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage):
@@ -286,6 +303,28 @@
             note=self.note)
 
+class SwitchLibraryAccessView(UtilityView, grok.View):
+    """ Switch the library attribute
+    """
+    grok.context(ICustomStudent)
+    grok.name('switch_library_access')
+    grok.require('waeup.switchLibraryAccess')
+
+    def update(self):
+        if self.context.library:
+            self.context.library = False
+            self.context.writeLogMessage(self, 'library access disabled')
+            self.flash(_('Library access disabled'))
+        else:
+            self.context.library = True
+            self.context.writeLogMessage(self, 'library access enabled')
+            self.flash(_('Library access enabled'))
+        self.redirect(self.url(self.context))
+        return
+
+    def render(self):
+        return
+
 class ExportJHLIdCard(UtilityView, grok.View):
-    """Deliver a an id card for the John Harris Library.
+    """Deliver an id card for the John Harris Library.
     """
     grok.context(ICustomStudent)
@@ -297,7 +336,7 @@
 
     omit_fields = (
-        'suspended', 'email',
+        'suspended', 'email', 'phone',
         'adm_code', 'suspended_comment',
-        'date_of_birth','reg_number',
+        'date_of_birth',
         'current_mode', 'certificate',
         'entry_session',
@@ -306,13 +345,18 @@
     form_fields = []
 
-    def _signatures(self):
-        return ([(
-            'Current HD<br /> D. R. (Exams & Records)<br /> '
-            'For: Registrar')],)
-
     def _sigsInFooter(self):
+        isStudent = getattr(
+            self.request.principal, 'user_type', None) == 'student'
+        if isStudent:
+            return ''
         return (_("Date, Reader's Signature"),
                 _("Date, Circulation Librarian's Signature"),
                 )
+
+    def update(self):
+        if not self.context.library:
+            self.flash(_('Forbidden!'), type="danger")
+            self.redirect(self.url(self.context))
+        return
 
     @property
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py	(revision 15370)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py	(revision 15371)
@@ -33,4 +33,10 @@
     """Representation of student base data.
     """
+
+    library = schema.Bool(
+        title = _(u'Library Id Card'),
+        default = False,
+        required = False,
+        )
 
 class ICustomStudentPersonal(INigeriaStudentPersonal):
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 15370)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py	(revision 15371)
@@ -41,7 +41,40 @@
     IExtFileStore, IFileStoreNameChooser)
 from waeup.kofa.students.interfaces import IStudentsUtils
+from waeup.kofa.tests.test_authentication import SECRET
 from waeup.uniben.testing import FunctionalLayer
 
 SAMPLE_FPM = os.path.join(os.path.dirname(__file__), 'sample.fpm')
+
+class OfficerUITests(StudentsFullSetup):
+    # Tests for Student class views and pages
+
+    layer = FunctionalLayer
+
+    def test_jhl_idcard_officer(self):
+        # Create library officer
+        self.app['users'].addUser('mrlibrary', SECRET)
+        self.app['users']['mrlibrary'].email = 'library@foo.ng'
+        self.app['users']['mrlibrary'].title = 'Carlo Pitter'
+        prmglobal = IPrincipalRoleManager(self.app)
+        prmglobal.assignRoleToPrincipal(
+            'waeup.LibraryClearanceOfficer', 'mrlibrary')
+        prmglobal.assignRoleToPrincipal(
+            'waeup.StudentsOfficer', 'mrlibrary')
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = 'mrlibrary'
+        self.browser.getControl(name="form.password").value = SECRET
+        self.browser.getControl("Login").click()
+        self.assertMatches('...You logged in...', self.browser.contents)
+        self.browser.open(self.student_path)
+        self.assertFalse('JHL' in self.browser.contents)
+        self.browser.getLink("Switch library access").click()
+        self.assertTrue('Library access enabled' in self.browser.contents)
+        self.assertTrue('JHL' in self.browser.contents)
+        self.browser.getLink("Download JHL Id Card").click()
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
+        path = os.path.join(samples_dir(), 'jhl_idcard_officer.pdf')
+        open(path, 'wb').write(self.browser.contents)
+        print "Sample PDF jhl_idcard_officer.pdf written to %s" % path
 
 class StudentUITests(StudentsFullSetup):
@@ -219,10 +252,14 @@
         self.browser.getControl(name="form.password").value = 'spwd'
         self.browser.getControl("Login").click()
+        self.assertFalse('JHL' in self.browser.contents)
+        self.student.library = True
+        self.browser.open(self.student_path)
+        self.assertTrue('JHL' in self.browser.contents)
         self.browser.getLink("Download JHL Id Card").click()
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
         self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
-        path = os.path.join(samples_dir(), 'jhl_idcard.pdf')
+        path = os.path.join(samples_dir(), 'jhl_idcard_student.pdf')
         open(path, 'wb').write(self.browser.contents)
-        print "Sample PDF jhl_idcard.pdf written to %s" % path
+        print "Sample PDF jhl_idcard_student.pdf written to %s" % path
 
     def test_jupeb_result_slip(self):
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py	(revision 15370)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py	(revision 15371)
@@ -56,5 +56,5 @@
             'fst_sit_type,hq2_degree,hq2_disc,hq2_matric_no,hq2_school,'
             'hq2_session,hq2_type,hq_degree,hq_disc,hq_fname,hq_matric_no,'
-            'hq_school,hq_session,hq_type,is_staff,lastname,lga,'
+            'hq_school,hq_session,hq_type,is_staff,lastname,lga,library,'
             'marit_stat,matric_number,middlename,nationality,'
             'next_kin_address,next_kin_name,next_kin_phone,next_kin_relation,'
@@ -68,5 +68,5 @@
             '"[(\'printing_craft_practice\', \'A1\')]",my clr code,1981-02-04#,,,'
             'anna@sample.com,,,,,,,,,,,,,Anna,,,,,,"[(\'printing_craft_practice\', \'A1\')]"'
-            ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,,,'
+            ',,,,,,,,,,,,,,,,Tester,,,,234,M.,NG,,,,,,,,,,'
             '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,,123,,,,,'
             '"[(\'printing_craft_practice\', \'A1\')]",,f,A111111,0,,,created,'
Index: main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py
===================================================================
--- main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py	(revision 15370)
+++ main/waeup.uniben/trunk/src/waeup/uniben/students/viewlets.py	(revision 15371)
@@ -32,4 +32,13 @@
 from kofacustom.nigeria.interfaces import MessageFactory as _
 
+class SwitchLibraryAccessActionButton(ManageActionButton):
+    grok.order(7)
+    grok.context(ICustomStudent)
+    grok.view(StudentBaseDisplayFormPage)
+    grok.require('waeup.switchLibraryAccess')
+    text = _('Switch library access')
+    target = 'switch_library_access'
+    icon = 'actionicon_book.png'
+
 class StudyCourseEditActionButton(ManageActionButton):
     grok.order(1)
@@ -122,7 +131,7 @@
     @property
     def target_url(self):
-        # temporarily disabled
-        return ''
-        return self.view.url(self.view.context, self.target)
+        if self.context.library:
+            return self.view.url(self.view.context, self.target)
+        return
 
 class JUPEBResultSlipActionButton(ManageActionButton):
