GroupsDirectory | |
Exaple 1: Creating a structure
>>> import gd >>> root = gd.root('public') >>> root.create(gd.GROUP, 'admins', c='Administrators') >>> root.create(gd.GROUP, 'adm.publ', c='Publisher Admins') >>> root.create(gd.GROUP, 'int.news.adm', c='Internal news admins') >>> root.create(gd.GROUP, 'pub.news.adm', c='Public news admins') >>> root.create(gd.GROUP, 'int.news.delete', c='Internal news delete permission') >>> root.create(gd.GROUP, 'int.news.write', c='Internal news write permission') >>> root.create(gd.GROUP, 'int.news.read', c='Internal news read permission') >>> root.create(gd.GROUP, 'pub.news.delete', c='Public news delete permission') >>> root.create(gd.GROUP, 'pub.news.write', c='Public news write permission') >>> root.create(gd.GROUP, 'pub.news.read', c='Public news read permission') >>> root.create(gd.ITEM, 'zaphod', 'Former President') >>> root.create(gd.ITEM, 'trillian', 'Zaphods friend') >>> root.create(gd.ITEM, 'marvin', 'Depressed robot') >>> root.create(gd.ITEM, 'ford', 'Hitchhiker') >>> root.create(gd.ITEM, 'arthur', 'Earth creature') >>> root.addMembers('zaphod', 'admins') >>> root.addMembers(('admins', 'trillian'), 'adm.publ') >>> root.addMembers('adm.publ', 'int.news.adm') >>> root.addMembers('int.news.adm', 'int.news.delete') >>> root.addMembers(('int.news.delete', 'marvin'), 'int.news.write') >>> root.addMembers(('pub.news.write', 'ford'), 'int.news.read') >>> root.addMembers(('ford', 'marvin', 'adm.publ'), 'pub.news.adm') >>> root.addMembers('pub.news.adm', 'pub.news.delete') >>> root.addMembers(('pub.news.delete', 'arthur'), 'pub.news.write') >>> root.addMembers('public', 'pub.news.read') >>> root.save('cmsrights.pic') | |
Explanation
First of all. For the whole content management system we've got an
administrator. In this case it's Zaphod. Since Zaphod is a
very busy man with developing a CMS software. He wants a person who can
administrate all the news-forums. That would in this case be Trillian. Trillian in her turn have given Marvin the right to write news in the internal news-forum. She doesn't allow him to delete posts tough. Despite his intelligence he's often depressed and can do unforseen things when questioning if there is a point with a news-forum. Trillian doesn't have unlimited time tough. So Zaphod lets Marvin and Ford to help the Publisher admins out in administer the public news forum. They get pub.news.adm permissions. Then we've got Arthur who are allowed to write posts in the public news forum. Last but not least the public are allowed to read the public news. |