Beispiel #1
0
def migrateGroups(catalog):
    print "Migrating groups...",
    gh=GroupHolder()
    count=0
    for g in catalog.dump():
        gh._getIdx()[g.getId()]=g
        count+=1
    print "[Done:%s]"%count
Beispiel #2
0
def migrateGroups(catalog):
    print "Migrating groups...",
    gh = GroupHolder()
    count = 0
    for g in catalog.dump():
        gh._getIdx()[g.getId()] = g
        count += 1
    print "[Done:%s]" % count
## along with Indico;if not, see <http://www.gnu.org/licenses/>.


from indico.core.db import DBMgr
from MaKaC.user import GroupHolder

"""
Set as obsolete the groups listed in a file
"""

fileGroups='GroupsDeletedInAD.txt'

DBMgr.getInstance().startRequest()
error = False
gh = GroupHolder()
groupIdx=gh._getIdx()

groupsObsoletes = open(fileGroups,'r')
for group in groupsObsoletes.readlines():
    gr=groupIdx.get(group.rstrip())
    if gr != None:
        gr.setObsolete(True)

if not error:
    DBMgr.getInstance().endRequest()
    print "Groups set as obsoleted."
    print "No error. The change are saved"
else:
    print "There were errors. The changes was not saved"

## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Indico;if not, see <http://www.gnu.org/licenses/>.

from MaKaC.common import DBMgr
from MaKaC.user import GroupHolder
"""
Set as obsolete the groups listed in a file
"""

fileGroups = 'GroupsDeletedInAD.txt'

DBMgr.getInstance().startRequest()
error = False
gh = GroupHolder()
groupIdx = gh._getIdx()

groupsObsoletes = open(fileGroups, 'r')
for group in groupsObsoletes.readlines():
    gr = groupIdx.get(group.rstrip())
    if gr != None:
        gr.setObsolete(True)

if not error:
    DBMgr.getInstance().endRequest()
    print "Groups set as obsoleted."
    print "No error. The change are saved"
else:
    print "There were errors. The changes was not saved"