changeset 2:03c4e248b9e2

Access rights added
author dwinter
date Thu, 30 Jun 2011 10:05:46 +0200
parents 95e1e37915c6
children 6f4b30846fed
files MPIWGThesaurus.py
diffstat 1 files changed, 28 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MPIWGThesaurus.py	Thu Jun 30 09:51:06 2011 +0200
+++ b/MPIWGThesaurus.py	Thu Jun 30 10:05:46 2011 +0200
@@ -14,7 +14,8 @@
 from Products.PageTemplates.PageTemplateFile import PageTemplateFile
 from BTrees.OOBTree import OOBTree
 from BTrees.OOBTree import OOSet
-   
+from AccessControl import ClassSecurityInfo
+
 #import os
 import os.path
 import logging
@@ -55,6 +56,8 @@
 
 class MPIWGThesaurus(Folder):
     """MPIWGThesaurus main folder"""
+    security=ClassSecurityInfo()
+
     meta_type="MPIWGThesaurus"
    
     TMP_PERSON_NS="http://ontologies.mpiwg-berlin.mpg.de/tempObjects/person/"
@@ -166,18 +169,19 @@
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','index.html')).__of__(self)
         return pt()
     
-    
+    security.declareProtected('View management screens','changeMPIWGThesaurusForm')
     def changeMPIWGThesaurusForm(self):
         """form for changing the project"""
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','changeMPIWGThesaurusForm.zpt')).__of__(self)
         return pt()
     
+    security.declareProtected('View management screens','manageMPIWGThesaurus')
     def manageMPIWGThesaurus(self):
         """form for changing the project"""
         pt=PageTemplateFile(os.path.join(package_home(globals()),'zpt','manageMPIWGThesaurus.zpt')).__of__(self)
         return pt()
     
-    
+    security.declareProtected('View management screens','changeMPIWGThesaurus')
     def changeMPIWGThesaurus(self,approachesTxt,disciplinesTxt,periodsTxt,spacesTxt,technologiesTxt,knowledgeTransfersTxt,RESPONSE=None):
         """change it"""
         self.approachesTxt=approachesTxt
@@ -192,6 +196,8 @@
      
     #In der Anzeige soll der Name der zitierten Personen in Klartext angezeigt werden, ausserdem die Varianten, wie sie tatsaechlich
     #in den Projekten benutzt werden
+    
+    security.declareProtected('View management screens','changeMPIWGThesaurus')
     def collectPersonNamesToIds(self):
         """Ordne Namen aus dem Triplestore bzw. die vergebenenden Label den Personen-Ids zu."""
         self.personIDtoNames=OOBTree() # loessche alle 
@@ -263,7 +269,7 @@
         return names[1].replace('"','') # wir nehmen nur den ersten treffer
          
             
-            
+    security.declareProtected('View management screens','changeTags')            
     def changeTags(self,projectID,approaches=[],disciplines=[],periods=[],spaces=[],technologies=[],transfers=[],RESPONSE=None):
         """change tags"""
         self.changeTagFromList(projectID,"approaches", approaches)
@@ -285,12 +291,14 @@
         
         self.suggestedPersons=self.suggestedPersons;
         
+    security.declareProtected('View management screens','deleteAllTags')                    
     def deleteAllTags(self):
         """deleteAllTags - TODO: take this out!!,"""
         setattr(self,"tags",None)
         
         return "DONE!"
     
+    security.declareProtected('View management screens','deleteAllPersons')                    
     def deleteAllPersons(self):
         """deleteAllTags - TODO: take this out!!,"""
         self.projectPersons= OOBTree()
@@ -300,6 +308,7 @@
     
         
         return "DONE!"
+    
     def changeTagFromList(self,projectID,tagType,tagList):
         
         logging.debug("changing:"+projectID)
@@ -393,6 +402,7 @@
         self.tagList=self.getEntriesFromTxt(self.approachesTxt)    
         return self.tagList
     
+  
     def getTagsJSON(self,projectID,tagType,RESPONSE=None):
         """get all selected tagList"""
         logging.debug("asking:"+projectID)
@@ -555,7 +565,7 @@
         logging.debug(type+":"+ret)
         return ret
     
-    
+    security.declareProtected('View management screens','removeHistoricalPlaceFromProject')                    
     def removeHistoricalPlaceFromProject(self,projectID,value):
         """remove"""
         logging.debug("removeHP:"+projectID+":"+value);
@@ -573,6 +583,7 @@
         logging.debug(retstring)
         return retstring
     
+    security.declareProtected('View management screens','removeObjectFromProject') 
     def removeObjectFromProject(self,projectID,value):
         """remove"""
         logging.debug("remove:"+projectID+":"+value);
@@ -590,6 +601,7 @@
         logging.debug(retstring)
         return retstring
     
+    security.declareProtected('View management screens','removePersonFromProject') 
     def removePersonFromProject(self,projectID,value):
         """remove"""
         logging.debug("remove:"+projectID+":"+value);
@@ -618,7 +630,7 @@
     
         self.personIDtoNames.update({personID:personName})
         
-        
+    security.declareProtected('View management screens','addPersonToProject')     
     def addPersonToProject(self,projectID,value,label):
         """ add a person so the project"""
         persons=self.getPersonsFromProject(projectID);
@@ -651,6 +663,7 @@
         transaction.commit()
         return retstring
     
+    
     def getPersonsWithProjectIDs(self):
         """holt die getaggted Personen mit Projekten"""
         persons = self.persons2Projects;
@@ -696,6 +709,7 @@
             ret[object]=list[0:]
         return ret
     
+    security.declareProtected('View management screens','listAllSuggestedTags')     
     def listAllSuggestedTags(self):
         """list all tags"""
         ret="<html><body>"
@@ -707,7 +721,8 @@
         ret+="</body></html>"
         logging.debug(ret);
         return ret
-        
+    
+    security.declareProtected('View management screens','suggestTag')     
     def suggestTag(self,projectID,tagName,tagComment,tagType,tagUserName):
         """suggest a new tag"""
         """ add a person so the project"""
@@ -749,7 +764,7 @@
         
         #return retstring
         
-    
+    security.declareProtected('View management screens','addHistoricalPlaceToProject')     
     def addHistoricalPlaceToProject(self,projectID,value):
         """ add a person so the project"""
         HistoricalPlaces=self.getHistoricalPlacesFromProject(projectID);
@@ -789,6 +804,7 @@
         
         return retstring
     
+    security.declareProtected('View management screens','addObjectToProject')     
     def addObjectToProject(self,projectID,value):
         """ add a person so the project"""
         objects=self.getObjectsFromProject(projectID);
@@ -875,7 +891,8 @@
 #               
 #              );         
 #    
-
+    
+    security.declareProtected('View management screens','addAndCreateNewPerson')     
     def addAndCreateNewPerson(self,projectID,personName,personComment,personUserName):
         """adds anew person to the project which is not in the authority file"""
         
@@ -890,7 +907,8 @@
         self.suggestedPersons.update({idstring:(personName,personComment,projectID,personUserName)})
         self.createTempPersonInVirtuoso(projectID, idstring, personName, personComment) #TODO: add suername to the triplestore
         return self.addPersonToProject(projectID, idstring, personName);
-        
+       
+    security.declareProtected('View management screens','createTempPersonInVirtuoso')     
     def createTempPersonInVirtuoso(self,projectID,personURI, personName,personComment):
         """add a new person to the triple store of tempory persons"""
         triples=[];