Changeset 16613
- Timestamp:
- 06/16/08 14:42:59 (4 months ago)
- Files:
-
- branches/MidCOM_2_8/midcom.admin.user/locale/default.en.txt (modified) (2 diffs)
- branches/MidCOM_2_8/midcom.admin.user/locale/default.fi.txt (modified) (2 diffs)
- branches/MidCOM_2_8/midcom.core/midcom/helper/metadata.php (modified) (4 diffs)
- branches/MidCOM_2_8/midcom.helper.datamanager2/controller.php (modified) (3 diffs)
- branches/MidCOM_2_8/midcom.helper.datamanager2/formmanager.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/MidCOM_2_8/midcom.admin.user/locale/default.en.txt
r13635 r16613 4 4 ---LANGUAGE en 5 5 6 ---STRING User Management 7 User Management 8 ---STRINGEND 9 6 10 ---STRING Your password has been changed. Your new password is __PASSWORD__ 7 11 Your password has been changed. Your new password is __PASSWORD__ … … 280 284 ---STRINGEND 281 285 282 ---STRING User Management283 User Management 284 ---STRINGEND 285 286 ---STRING enable unlocking locked objects 287 Enable unlocking locked objects 288 ---STRINGEND 289 branches/MidCOM_2_8/midcom.admin.user/locale/default.fi.txt
r13635 r16613 4 4 ---LANGUAGE fi 5 5 6 ---STRING User Management 7 KÀyttÀjien hallinta 8 ---STRINGEND 9 6 10 ---STRING Your password has been changed. Your new password is __PASSWORD__ 7 11 Salasanasi on vaihdettu. Uusi salasanasi on __PASSWORD__ … … 280 284 ---STRINGEND 281 285 282 ---STRING User Management283 KÀyttÀjien hallinta 284 ---STRINGEND 285 286 ---STRING enable unlocking locked objects 287 Salli lukitusten purkaminen 288 ---STRINGEND 289 branches/MidCOM_2_8/midcom.core/midcom/helper/metadata.php
r16541 r16613 749 749 if ($this->get('locked') === 0) 750 750 { 751 return false; 752 } 753 754 if ($this->get('locked') - time() > $GLOBALS['midcom_config']['metadata_lock_timeout'] * 60) 755 { 756 return true; 757 } 758 759 // Get the person who locked the this 760 // Lock was created by the user, allow unquestionable editing 751 // Make sure locker is empty too 752 if ($this->get('locker') != '') 753 { 754 $this->set('locker', ''); 755 } 756 return false; 757 } 758 759 if (($this->get('locked') + ($GLOBALS['midcom_config']['metadata_lock_timeout'] * 60)) < time()) 760 { 761 // lock expired, explicitly clear lock 762 $this->set('locked', 0); 763 $this->set('locker', ''); 764 return false; 765 } 766 767 // Lock was created by the user, return "not locked" 761 768 if ( isset($_MIDCOM->auth->user) 762 769 && isset($_MIDCOM->auth->user->guid) 763 && $this->get('locker') !== $_MIDCOM->auth->user->guid) 764 { 765 return true; 766 } 767 768 // Locks checked, this isn't locked 769 return false; 770 } 771 772 770 && $this->get('locker') === $_MIDCOM->auth->user->guid) 771 { 772 return false; 773 } 774 775 // Unlocked states checked and none matched, consider locked 776 return true; 777 } 778 773 779 /** 774 780 * Set the object lock … … 805 811 806 812 /** 813 * Check whether current user can unlock the object 814 * 815 * @return boolean indicating privileges 816 * @todo enable specifying user ? 817 */ 818 function can_unlock() 819 { 820 if ( !$this->object->can_do('midcom:unlock') 821 && !$_MIDCOM->auth->can_user_do('midcom:unlock', null, 'midcom_services_auth', 'midcom')) 822 { 823 return false; 824 } 825 return true; 826 } 827 828 /** 807 829 * Unlock the object 808 830 * … … 812 834 function unlock() 813 835 { 814 if (!$_MIDCOM->auth->can_user_do('midcom:unlock', null, 'midcom_services_auth', 'midcom')) 815 { 816 return false; 817 } 818 819 836 if (!$this->can_unlock()) 837 { 838 return false; 839 } 840 820 841 if ( !$this->set('locker', '') 821 842 || !$this->set('locked', '')) … … 823 844 return false; 824 845 } 825 846 826 847 return true; 827 848 } branches/MidCOM_2_8/midcom.helper.datamanager2/controller.php
r16586 r16613 260 260 { 261 261 // Get the metadata object 262 $metadata = $this->datamanager->storage->object->get_metadata();262 $metadata =& $this->datamanager->storage->object->get_metadata(); 263 263 264 264 if ($metadata->is_locked()) … … 288 288 else 289 289 { 290 $metadata =& $this->datamanager->storage->object->get_metadata(); 290 291 $person = new midcom_db_person($this->datamanager->storage->object->metadata->locker); 291 292 ?> … … 294 295 <p> 295 296 <?php echo sprintf($this->_l10n->get('this object was locked by %s'), $person->name); ?>. 296 <?php echo sprintf($this->_l10n->get('lock will expire on %s'), strftime('%x %X', $this->datamanager->storage->object->metadata->locked)); ?>.297 <?php echo sprintf($this->_l10n->get('lock will expire on %s'), strftime('%x %X', ($metadata->get('locked') + ($GLOBALS['midcom_config']['metadata_lock_timeout'] * 60)))); ?>. 297 298 </p> 298 299 <?php 299 if ($ _MIDCOM->auth->can_user_do('midcom:unlock', null, 'midcom_services_auth', 'midcom.core'))300 if ($metadata->can_unlock()) 300 301 { 301 302 echo "<form method=\"post\">\n"; branches/MidCOM_2_8/midcom.helper.datamanager2/formmanager.php
r16539 r16613 1038 1038 1039 1039 // Remove the lock, if permission is granted 1040 if ($ _MIDCOM->auth->can_user_do('midcom:unlock', null, 'midcom_services_auth', 'midcom.core'))1040 if ($metadata->can_unlock()) 1041 1041 { 1042 1042 $metadata->unlock();
