Ejemplo n.º 1
0
 def setUp(self):
     self.config = testing.setUp()
     from sqlalchemy import create_engine
     engine = create_engine('sqlite://')
     from .models import Base
     DBSession.configure(bind=engine)
     Base.metadata.create_all(engine)
     with transaction.manager:
         pass
Ejemplo n.º 2
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    Base.metadata.create_all(engine)
    with transaction.manager:
        # Add Groups
        u = UserLib()
        u.create_group("forum_moderator",
                       "Ability to Edit " + "and Delete forum posts/threads.")
        u.create_group("forum", "Ability to Add forum posts/threads.")

        # Default ACL
        acl = RootFactory(session=DBSession)
        acl.__acl__.append((Allow, Everyone, 'forum_view'))
        acl.__acl__.append((Allow, "group:admin", 'edit_board'))
        acl.__acl__.append((Allow, "group:forum", "group:forum"))
        acl.__acl__.append((Allow, "group:forum", 'forum_reply'))
        acl.__acl__.append((Allow, "group:forum", 'forum_edit'))
        acl.__acl__.append((Allow, "group:forum", 'forum_delete'))
        acl.__acl__.append(
            (Allow, "group:forum_moderator", "group:forum_moderator"))
        acl.__acl__.append((Allow, "group:forum_moderator", 'forum_mod_edit'))
        acl.__acl__.append(
            (Allow, "group:forum_moderator", 'forum_mod_delete'))

        # Add Menu Items
        m = MenuLib()
        m.add_menu_item_route("Forum", "category_list", 10,
                              m.show_group("main_menu"), Everyone)
        group = m.show_group("admin_area")
        m.add_menu_item_route("Forum Categories", "edit_forum_category", 20,
                              group, 'edit_menu')
        m.add_menu_item_route("Edit Forums", "list_forum_category", 21, group,
                              'edit_menu')

        # Append CSS
        s = SettingsLib()
        s.update("CSS", s.show_setting("CSS") + css)
        s.create("INFO_FORUM_CATEGORY_UPDATED",
                 "The list of forum categories has been updated.")
        s.create("PYRACMS_FORUM")
        s.update("DEFAULTGROUPS", s.show_setting("DEFAULTGROUPS") + "forum\n")
Ejemplo n.º 3
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    Base.metadata.create_all(engine)
    with transaction.manager:
        # Add Operating Systems
        DBSession.add(OperatingSystems("pi", "Platform Independent"))
        DBSession.add(OperatingSystems("win", "Windows"))
        DBSession.add(OperatingSystems("mac", "Mac OS X"))
        DBSession.add(OperatingSystems("lin", "Linux"))
        DBSession.add(OperatingSystems("sol", "Solaris"))
        DBSession.add(OperatingSystems("fbsd", "FreeBSD"))
        DBSession.add(OperatingSystems("nbsd", "NetBSD"))
        DBSession.add(OperatingSystems("obsd", "OpenBSD"))
        
        # Add Architectures
        DBSession.add(Architectures("pi", "Platform Independent"))
        DBSession.add(Architectures("i386", "32bit X86"))
        DBSession.add(Architectures("x86_64", "64bit X86"))
        DBSession.add(Architectures("arm", "ARM Little Endian"))
        DBSession.add(Architectures("armeb", "ARM Big Endian"))
        DBSession.add(Architectures("ppc", "32bit PowerPC"))
        DBSession.add(Architectures("ppc64", "64bit PowerPC"))
        DBSession.add(Architectures("sparc", "32bit SPARC"))
        DBSession.add(Architectures("sparc64", "64bit SPARC"))
    
        # Default Groups
        u = UserLib()
        u.create_group("gamedep", "Ability to Add, Edit and Delete" +
                       " games and dependencies.")
        
        # Default ACL
        acl = RootFactory()
        acl.__acl__.append((Allow, Everyone, 'gamedep_view'))
        acl.__acl__.append((Allow, Everyone, 'gamedep_list'))
        acl.__acl__.append((Allow, "group:admin", 'gamedep_mod'))
        acl.__acl__.append((Allow, "group:gamedep", "group:gamedep"))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_view'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_list'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_publish'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_edit'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_delete'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_add_picture'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_delete_picture'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_add_source'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_add_binary'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_edit_binary'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_delete_binary'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_add_dependency'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_delete_dependency'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_edit_revision'))
        
        s = SettingsLib()
        s.update("DEFAULTGROUPS", s.show_setting("DEFAULTGROUPS") + 
                 "gamedep\n")
        s.create("INFO_PIC_ADDED", "Your picture (%s) has been added.")
        s.create("INFO_PIC_DELETED", "Your picture (%s) has been deleted.")
        s.create("INFO_BINARY_ADDED", "Your binary (%s) has been added.")
        s.create("INFO_BINARY_UPDATED", "Your binary (%s) has been updated.")
        s.create("INFO_BINARY_DELETED", "Your binary (%s) has been deleted.")
        s.create("INFO_SOURCE_UPLOADED", "The source code (%s) has been "
                                         "successfully uploaded.")
        s.create("INFO_DEPENDENCY_ADDED",
                 "Your dependency (%s) has been added.")
        s.create("INFO_DEPENDENCY_DELETED",
                 "Your dependency (%s) has been deleted.")
        s.create("INFO_REVISION_UPDATED", "A new version (%s) has been "
                                          "updated for %s.")
        s.create("INFO_REVISION_CREATED", "A new version (%s) has been "
                                          "created for %s.")
        s.create("ERROR_INVALID_BINARY_ID",
                 "Invalid Binary ID and/or Edit Type.")
        s.create("ERROR_NOT_UPLOADED_BINARY",
                 "You have not uploaded any binaries.")
        s.create("ERROR_NOT_UPLOADED_SOURCE_CODE",
                 "You have not uploaded any source code.")
        s.create("HYPERNUCLEUS_SERVER")

        m = MenuLib()
        group = m.show_group("main_menu")
        m.add_menu_item_route("Games", "gamedeplist", 3, group, Everyone,
                              {"type": GAME})
        m.add_menu_item_route("Dependencies", "gamedeplist", 4,
                              group, Everyone, {"type": DEP})
Ejemplo n.º 4
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    Base.metadata.create_all(engine)
    with transaction.manager:
        # Add Operating Systems
        DBSession.add(OperatingSystems("pi", "Platform Independent"))
        DBSession.add(OperatingSystems("win", "Windows"))
        DBSession.add(OperatingSystems("mac", "Mac OS X"))
        DBSession.add(OperatingSystems("lin", "Linux"))
        DBSession.add(OperatingSystems("sol", "Solaris"))
        DBSession.add(OperatingSystems("fbsd", "FreeBSD"))
        DBSession.add(OperatingSystems("nbsd", "NetBSD"))
        DBSession.add(OperatingSystems("obsd", "OpenBSD"))

        # Add Architectures
        DBSession.add(Architectures("pi", "Platform Independent"))
        DBSession.add(Architectures("i386", "32bit X86"))
        DBSession.add(Architectures("x86_64", "64bit X86"))
        DBSession.add(Architectures("arm", "ARM Little Endian"))
        DBSession.add(Architectures("armeb", "ARM Big Endian"))
        DBSession.add(Architectures("ppc", "32bit PowerPC"))
        DBSession.add(Architectures("ppc64", "64bit PowerPC"))
        DBSession.add(Architectures("sparc", "32bit SPARC"))
        DBSession.add(Architectures("sparc64", "64bit SPARC"))

        # Default Groups
        u = UserLib()
        u.create_group(
            "gamedep",
            "Ability to Add, Edit and Delete" + " games and dependencies.")

        # Default ACL
        acl = RootFactory()
        acl.__acl__.append((Allow, Everyone, 'gamedep_view'))
        acl.__acl__.append((Allow, Everyone, 'gamedep_list'))
        acl.__acl__.append((Allow, "group:admin", 'gamedep_mod'))
        acl.__acl__.append((Allow, "group:gamedep", "group:gamedep"))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_view'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_list'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_publish'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_edit'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_delete'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_add_picture'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_delete_picture'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_add_source'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_add_binary'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_edit_binary'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_delete_binary'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_add_dependency'))
        acl.__acl__.append(
            (Allow, "group:gamedep", 'gamedep_delete_dependency'))
        acl.__acl__.append((Allow, "group:gamedep", 'gamedep_edit_revision'))

        s = SettingsLib()
        s.update("DEFAULTGROUPS",
                 s.show_setting("DEFAULTGROUPS") + "gamedep\n")
        s.create("INFO_PIC_ADDED", "Your picture (%s) has been added.")
        s.create("INFO_PIC_DELETED", "Your picture (%s) has been deleted.")
        s.create("INFO_BINARY_ADDED", "Your binary (%s) has been added.")
        s.create("INFO_BINARY_UPDATED", "Your binary (%s) has been updated.")
        s.create("INFO_BINARY_DELETED", "Your binary (%s) has been deleted.")
        s.create("INFO_SOURCE_UPLOADED", "The source code (%s) has been "
                 "successfully uploaded.")
        s.create("INFO_DEPENDENCY_ADDED",
                 "Your dependency (%s) has been added.")
        s.create("INFO_DEPENDENCY_DELETED",
                 "Your dependency (%s) has been deleted.")
        s.create("INFO_REVISION_UPDATED", "A new version (%s) has been "
                 "updated for %s.")
        s.create("INFO_REVISION_CREATED", "A new version (%s) has been "
                 "created for %s.")
        s.create("ERROR_INVALID_BINARY_ID",
                 "Invalid Binary ID and/or Edit Type.")
        s.create("ERROR_NOT_UPLOADED_BINARY",
                 "You have not uploaded any binaries.")
        s.create("ERROR_NOT_UPLOADED_SOURCE_CODE",
                 "You have not uploaded any source code.")
        s.create("HYPERNUCLEUS_SERVER")

        m = MenuLib()
        group = m.show_group("main_menu")
        m.add_menu_item_route("Games", "gamedeplist", 3, group, Everyone,
                              {"type": GAME})
        m.add_menu_item_route("Dependencies", "gamedeplist", 4, group,
                              Everyone, {"type": DEP})
Ejemplo n.º 5
0
def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    Base.metadata.create_all(engine)
    with transaction.manager:
        # Add Groups
        u = UserLib()
        u.create_group(
            "article",
            "Ability to Add, Edit, Delete, " + "Revert and Protect Articles.")

        # Default ACL
        acl = RootFactory(session=DBSession)
        acl.__acl__.append((Allow, "group:admin", "switch_renderer"))
        acl.__acl__.append((Allow, "group:admin", "set_private"))
        acl.__acl__.append((Allow, "group:admin", "article_mod"))
        acl.__acl__.append((Allow, Authenticated, "article_list_revisions"))
        acl.__acl__.append((Allow, Everyone, "article_view"))
        acl.__acl__.append((Allow, Everyone, "article_list"))
        acl.__acl__.append((Allow, "group:article", "group:article"))
        acl.__acl__.append((Allow, "group:article", "article_view"))
        acl.__acl__.append((Allow, "group:article", "article_list"))
        acl.__acl__.append((Allow, "group:article", "article_create"))
        acl.__acl__.append((Allow, "group:article", "article_update"))
        acl.__acl__.append((Allow, "group:article", "article_delete"))
        acl.__acl__.append((Allow, "group:article", "article_revert"))

        # Add settings
        s = SettingsLib()
        s.create("PYRACMS_ARTICLE")
        s.update("DEFAULTGROUPS",
                 s.show_setting("DEFAULTGROUPS") + "article\n")

        # Add Menu Items
        m = MenuLib()
        group = m.show_group("main_menu")
        m.add_menu_item_route("Articles", "article_list", 2, group, Everyone)

        group = m.show_group("admin_area")
        m.add_menu_item_route("Backup Articles",
                              "userarea_admin_backup_articles", 8, group,
                              'backup')
        m.add_menu_item_route("Restore Articles",
                              "userarea_admin_restore_articles", 9, group,
                              'backup')

        group = MenuGroup("article_not_revision")
        m.add_menu_item_url("Comments", "/article/item/%(page_id)s?comments",
                            1, group, 'forum_view')
        m.add_menu_item_route("Gallery", "show_album", 2, group, 'show_album')
        m.add_menu_item_route("Edit", "article_update", 3, group,
                              'article_update')
        m.add_menu_item_route("Delete", "article_delete", 4, group,
                              'article_delete')
        m.add_menu_item_route("Switch Renderer [%(renderer)s]",
                              "article_switch_renderer", 5, group,
                              'switch_renderer')
        m.add_menu_item_route("Make %(private)s", "article_set_private", 6,
                              group, 'set_private')
        m.add_menu_item_route("%(hideshow)s Display Name",
                              "article_hide_display_name", 7, group,
                              'set_private')
        m.add_menu_item_url("Vote Up (%(up_count)s)",
                            "/vote/article/%(page_id)s/True", 8, group, 'vote')
        m.add_menu_item_url("Vote Down (%(down_count)s)",
                            "/vote/article/%(page_id)s/False", 9, group,
                            'vote')
        m.add_menu_item_route("List Revisions", "article_list_revisions", 10,
                              group, 'article_list_revisions')

        group = MenuGroup("article_revision")
        m.add_menu_item_route("List Revisions", "article_list_revisions", 1,
                              group, 'article_list_revisions')
        m.add_menu_item_route("Revert", "article_revert", 2, group,
                              "article_revert")

        # Add Renderers
        DBSession.add(ArticleRenderers("HTML"))
        DBSession.add(ArticleRenderers("BBCODE"))
        DBSession.add(ArticleRenderers("RESTRUCTUREDTEXT"))
        DBSession.add(ArticleRenderers("MARKDOWN"))