Esempio n. 1
0
 def createInProductFolder(self):
     homefolder = IHomeFolder(self.principal).homeFolder
     if not homefolder:
         utility = getUtility(IHomeFolderManager)
         utility.assignHomeFolder(uvcsite.IMasterUser(self.principal).id)
     if self.folderURI and not self.folderURI in homefolder.keys():
         pf = self.productfolder
         homefolder[self.folderURI] = pf()
         uvcsite.log('Add Productfolders %s to Homefolder: %s' % (self.folderURI, self.principal.id), severity=logging.DEBUG)
Esempio n. 2
0
def applyPermissionsForExistentCoUsers(factory):
    principal = factory.object
    createProductFolders(principal)
    homefolder = IHomeFolder(principal).homeFolder
    if not homefolder:
        return
    um = getUtility(IUserManagement)
    user = um.getUser(principal.id)
    rollen = user['rollen']
    if user['az'] != '00':
        pid = "%s-%s" % (user['mnr'], user['az'])
    else:
        pid = user['mnr']
    if homefolder.__name__ != pid:
        for pf in homefolder.keys():
            if pf in rollen:
                prm = IPrincipalRoleManager(homefolder.get(pf))
                if prm.getSetting('uvc.Editor', pid).getName() == 'Unset':
                    prm.assignRoleToPrincipal('uvc.Editor', pid)
                    uvcsite.log('Give uvc.Editor to %s in folder %s' % (pid, pf))