当前位置: 首页>>代码示例>>Python>>正文


Python Environment.get_security方法代码示例

本文整理汇总了Python中pyasm.common.Environment.get_security方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_security方法的具体用法?Python Environment.get_security怎么用?Python Environment.get_security使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyasm.common.Environment的用法示例。


在下文中一共展示了Environment.get_security方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_display

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def get_display(my):

        web = WebContainer.get_web()
        context_url = web.get_context_url().to_string()
        js_url = "%s/javascript" % context_url
        spt_js_url = "%s/spt_js" % context_url    # adding new core "spt" javascript library folder

        version = Environment.get_release_version()

        # add some third party libraries
        third_party = js_includes.third_party
        security = Environment.get_security()


        for include in js_includes.third_party:
            Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include))

        all_js_path = js_includes.get_compact_js_filepath()

        if os.path.exists( all_js_path ):
            Container.append_seq("Page:js", "%s/%s" % (context_url, js_includes.get_compact_js_context_path_suffix()))
        else:
            for include in js_includes.legacy_core:
                Container.append_seq("Page:js", "%s/%s" % (js_url,include))

            for include in js_includes.spt_js:
                Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include))

            for include in js_includes.legacy_app:
                Container.append_seq("Page:js", "%s/%s" % (js_url,include))




        # custom js files to include
        includes = Config.get_value("install", "include_js")
        includes = includes.split(",")
        for include in includes:
            include = include.strip()
            if include:
                print "include: ", include
                Container.append_seq("Page:js", include)



        widget = Widget()

        js_files = Container.get("Page:js")
        for js_file in js_files:
            widget.add('<script src="%s?ver=%s" ></script>\n' % (js_file,version) )


        return widget
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:55,代码来源:top_wdg.py

示例2: get_display

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def get_display(my):

        web = WebContainer.get_web()
        context_url = web.get_context_url().to_string()
        js_url = "%s/javascript" % context_url
        spt_js_url = "%s/spt_js" % context_url    # adding new core "spt" javascript library folder

        version = Environment.get_release_version()

        # add some third party libraries
        third_party = js_includes.third_party
        security = Environment.get_security()

        # FIXME: this logic should not be located here.
        # no reason to have the edit_area_full.js
        if not security.check_access("builtin", "view_script_editor", "allow") and security.check_access("builtin", "view_site_admin", "allow"):
            if "edit_area/edit_area_full.js" in third_party:
                third_party.remove("edit_area/edit_area_full.js")


        for include in js_includes.third_party:
            Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include))

        all_js_path = js_includes.get_compact_js_filepath()

        if os.path.exists( all_js_path ):
            Container.append_seq("Page:js", "%s/%s" % (context_url, js_includes.get_compact_js_context_path_suffix()))
        else:
            for include in js_includes.legacy_core:
                Container.append_seq("Page:js", "%s/%s" % (js_url,include))

            for include in js_includes.spt_js:
                Container.append_seq("Page:js", "%s/%s" % (spt_js_url,include))

            for include in js_includes.legacy_app:
                Container.append_seq("Page:js", "%s/%s" % (js_url,include))


        #Container.append_seq("Page:js", "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js")
        #Container.append_seq("Page:js", "/context/spt_js/UnityObject.js")


        #widget = DivWdg()
        #widget.set_id("javascript")
        #my.set_as_panel(widget)
        widget = Widget()

        js_files = Container.get("Page:js")
        for js_file in js_files:
            widget.add('<script src="%s?ver=%s" ></script>\n' % (js_file,version) )


        return widget
开发者ID:blezek,项目名称:TACTIC,代码行数:55,代码来源:top_wdg.py

示例3: test_all

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def test_all(self):
        batch = Batch()
        Environment.get_security().set_admin(True)

        from pyasm.unittest import UnittestEnvironment, Sample3dEnvironment
        test_env = UnittestEnvironment()
        test_env.create()

        sample3d_env = Sample3dEnvironment(project_code='sample3d')
        sample3d_env.create()

        Project.set_project("unittest")
        try:
            self.access_manager = Environment.get_security().get_access_manager()   
            self._test_all()

        finally:
            # Reset access manager for tear down 
            Environment.get_security()._access_manager =  self.access_manager
            Environment.get_security().reset_access_manager() 
            self._tear_down()
            Environment.get_security().set_admin(True)
            test_env.delete()
            Environment.get_security().set_admin(True)
            sample3d_env.delete()
            Site.pop_site()
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:security_test.py

示例4: _get_base_job

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def _get_base_job(my):

        cpus = 1

        job_type = my.render_package.get_option("job_type")

        # generic qube parameters
        job = {
            'name': job_type,
            'prototype': job_type,
            'cpus': cpus,
            'priority': my.queue.get_value("priority"),
        }


        # create an agenda based on the frames ...
        frame_range = my.render_package.get_frame_range()
        start, end, by = frame_range.get_values()
        frames = qb.genframes("%s-%s" % (start, end) )
        if frames:
            job['agenda'] = frames


        # create a default package
        package = {}
        job['package'] = package


        # store the ticket in the job
        # FIXME: the problem with this is that the ticket may expire before
        # the job actually gets executed
        ticket = Environment.get_security().get_ticket_key()
        package['ticket'] = ticket

        return job
开发者ID:0-T-0,项目名称:TACTIC,代码行数:37,代码来源:qube_render_submit.py

示例5: set_admin

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def set_admin(self, flag, sudo=False):
        self.set_up()
        security = Environment.get_security()

        if security.get_user_name() == "admin":
            self.is_admin_flag = True
            return


        self.is_admin_flag = flag

        """
        if flag == False:
            import traceback, sys
            # print the stacktrace
            tb = sys.exc_info()[2]
            stacktrace = traceback.format_tb(tb)
            stacktrace_str = "".join(stacktrace)
            print "-"*50
            print "TRACE: ", self.was_admin
            print stacktrace_str
            print "-"*50
        """


        if not self.was_admin and flag:
            if 'admin' not in security.get_group_names():
                security._group_names.append('admin')
        elif 'admin' in security.get_group_names():
            if not self.was_admin:
                security._group_names.remove('admin')
开发者ID:mincau,项目名称:TACTIC,代码行数:33,代码来源:access_manager.py

示例6: get_render_dir

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def get_render_dir(my):
        ticket = Environment.get_security().get_ticket_key()
        tmpdir = Environment.get_tmp_dir()
        render_dir = "%s/temp/%s" % (tmpdir, ticket)
        System().makedirs(render_dir)

        return render_dir
开发者ID:0-T-0,项目名称:TACTIC,代码行数:9,代码来源:qube_render_submit.py

示例7: get_file_menu

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def get_file_menu(self):

        menu_items = [
                { "type": "action", "label": "Export All...", "bvr_cb": {
                  'cbfn_action': "spt.dg_table_action.set_actionbar_aux_content",
                        'class_name': 'tactic.ui.widget.CsvExportWdg',
                        'args': {"table_id": "%s" %self.table_id, \
                                 "is_export_all": "true"}}},


                { "type": "action", "label": "Export Selected", "bvr_cb": {
                    'cbfn_action': "spt.dg_table_action.set_actionbar_aux_content",
                        'class_name': 'tactic.ui.widget.CsvExportWdg',
                        'args': {"table_id": "%s" %self.table_id}}},
                

                { "type": "separator" },
                { "type": "action", "label": "Sign Out", "bvr_cb": {'cbjs_action': "alert('File->Sign Out');"} }
        ]

        security = Environment.get_security()
        if security.check_access("builtin", "view_site_admin", "allow"):
            menu_items.insert(0, { "type": "action", "label": "Import CSV", "bvr_cb": {
                    'cbfn_action':  "spt.dg_table_action.set_actionbar_aux_content",
                        'class_name': 'tactic.ui.widget.CsvImportWdg',
                        'args': {"table_id": "%s" %self.table_id} }})

        return {'menu_id': 'ActionBar_FileMenu_Main', 'width': 150, 'allow_icons': False,
                'opt_spec_list': menu_items}
开发者ID:mincau,项目名称:TACTIC,代码行数:31,代码来源:action_bar_wdg.py

示例8: _do_login

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def _do_login(self):

        security = Environment.get_security()

        require_password = Config.get_value("security", "api_require_password")
        api_password = Config.get_value("security", "api_password")

        site = Site.get()
        allow_guest =  site.allow_guest()

        # the xmlrpc login can be overridden to not require a password
        if require_password == "false" or (allow_guest and self.login_name == "guest"):
            security.login_user_without_password(self.login_name, expiry="NULL")
        elif api_password:
            if api_password == self.password:
                security.login_user_without_password(self.login_name, expiry="NULL")
            else:
                # if api password is incorrect, still try and authenticate with
                # user's password
                security.login_user(self.login_name, self.password, expiry="NULL")
        elif self.login_name == "guest":
                security.login_user_without_password(self.login_name)
        else:        
            security.login_user(self.login_name, self.password, expiry="NULL")

        if not security.is_logged_in():
            raise SecurityException("Cannot login as user: %s." % self.login_name)
开发者ID:mincau,项目名称:TACTIC,代码行数:29,代码来源:batch.py

示例9: get_license_info_wdg

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def get_license_info_wdg(self):
        div = DivWdg()

        license = Environment.get_security().get_license()
        if self.first_error:
            return div
        #if not license.is_licensed():
        #    return div

        msg = DivWdg()
        div.add(msg)
        msg.add("The following describes the details of the installed license:<br/><br/>")


        info_wdg = DivWdg()
        div.add(info_wdg)
        info_wdg.add_style("margin: 10px 30px")
        info_wdg.add_style("font-size: 12px")

        version = license.get_data("tactic_version")
        if version:
            info_wdg.add("TACTIC Version: ")
            if version == "ALL":
                version = "ALL (Open Source)"
            info_wdg.add(version)
            info_wdg.add(HtmlElement.br(2))


        company = license.get_data("company")
        info_wdg.add("Licensed To: ")
        if company.find("Southpaw EPL") != -1:
            company = SpanWdg("<a name='license'>Eclipse Public License v1.0</a> &nbsp;")
            icon = IconWdg("EPL v1.0", IconWdg.ZOOM)
            company.add(icon)
            company.add_class("hand")
            company.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                    spt.help.load_alias("license")
                '''
            } )
        info_wdg.add(company)
        info_wdg.add(HtmlElement.br(2))

        info_wdg.add("Max Users: ")
        info_wdg.add(license.get_data("max_users") )
        info_wdg.add(HtmlElement.br(2))

        info_wdg.add("Current Users: ")
        info_wdg.add(license.get_current_users() )
        info_wdg.add(HtmlElement.br(2))

        info_wdg.add("Expiry Date: ")
        expiry_date = license.get_data("expiry_date")
        if not expiry_date:
            expiry_date = "Permanent"
        info_wdg.add(expiry_date)
        info_wdg.add(HtmlElement.br(2))

        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:62,代码来源:license_manager_wdg.py

示例10: _do_login

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def _do_login(my):

        security = Environment.get_security()
        ticket = security.login_with_ticket(my.ticket)

        if not ticket:
            raise SecurityException("Cannot login with key: %s. Session may have expired." % my.ticket)
开发者ID:funic,项目名称:TACTIC,代码行数:9,代码来源:batch.py

示例11: _test_access_level

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def _test_access_level(my):
        security = Environment.get_security()
        from pyasm.security import get_security_version
        security_version = get_security_version()


        projects = Search.eval('@SOBJECT(sthpw/project)')
        if security_version >= 2:
            for project in projects:
                key = { "code": project.get_code() }
                key2 = { "code": "*" }
                keys = [key, key2]
                default = "deny"
                # other than sample3d, unittest as allowed above, a default low access level user 
                # should not see other projects
                access = security.check_access("project", keys, "allow", default=default)
                process_keys = [{'process': 'anim'}]
                proc_access = security.check_access("process", process_keys, "allow")
                my.assertEquals(proc_access, True)
                if project.get_code() in ['sample3d','unittest']:
                    my.assertEquals(access, True)
                else:
                    my.assertEquals(access, False)
        else:
            raise SecurityException('Please test with security version 2. Set it in your config file')
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:27,代码来源:security_test.py

示例12: insert_data_check

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
def insert_data_check(server=None, input_data=None):
    department_request_sobject = input_data.get('sobject')

    if not department_request_sobject.get('name'):
        raise TacticException("Name field is required.")

    if not department_request_sobject.get('due_date'):
        raise TacticException("Due Date field is required.")

    if not department_request_sobject.get('description'):
        raise TacticException("Description field is required.")

    # If 'status' is not set, set it to 'in_progress' by default
    if not department_request_sobject.get('status'):
        status = 'in_progress'
    else:
        status = None

    # If 'login' is not in the inserted sobject, insert it using the logged in user's name
    if not department_request_sobject.get('login'):
        login = Environment.get_security().get_login().get_login()
    else:
        login = None

    # If either status or login was set, and update is needed
    if status or login:
        update_dictionary = {}

        if status:
            update_dictionary['status'] = status
        if login:
            update_dictionary['login'] = login

        # Send the update data
        server.update(department_request_sobject.get('__search_key__'), update_dictionary)
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:37,代码来源:department_request_required_fields.py

示例13: get_tools_menu

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def get_tools_menu(self):
        menu_items = [

                #{ "type": "action", "label": "Search Types Manager",
                #        "bvr_cb": {'cbjs_action': "spt.panel.load('main_body','tactic.ui.panel.SearchTypeManagerWdg')"} },
                #{ "type": "separator" },
               
                
                { "type": "action", "label": "Web Client Output Log",
                        "bvr_cb": {'cbjs_action': "spt.js_log.show(false);"} },
                { "type": "action", "label": "TACTIC Script Editor",
                        "bvr_cb": {'cbjs_action': 'spt.panel.load_popup("TACTIC Script Editor",\
                                "tactic.ui.app.ShelfEditWdg", {}, {"load_once": true} );'} }
               

            ]
        security = Environment.get_security()
        if security.check_access("builtin", "view_site_admin", "allow"):
            menu_items.insert(0,  {"type": "action", "label": "Create New Project",
                        "bvr_cb": { 'cbjs_action': "spt.popup.open('create_project_wizard'); Effects.fade_in($('create_project_wizard'), 200);"}})
            menu_items.insert(1, { "type": "separator" })

        return {
            'menu_id': 'ActionBar_ToolsMenu_Main', 'width': 140, 'allow_icons': False,
            'opt_spec_list': menu_items
        }
开发者ID:mincau,项目名称:TACTIC,代码行数:28,代码来源:action_bar_wdg.py

示例14: get_main_menu

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def get_main_menu(my):

        security = Environment.get_security()
        if security.check_access("builtin", "view_site_admin", "allow"):

            return {
                "menu_tag_suffix": "MAIN",
                "width": 110,
                "opt_spec_list": [
                    {"type": "submenu", "label": "Add", "submenu_tag_suffix": "ADD"},
                    {"type": "submenu", "label": "Edit", "submenu_tag_suffix": "EDIT"},
                    {"type": "submenu", "label": "Tools", "submenu_tag_suffix": "TOOLS"},
                    {"type": "submenu", "label": "Help", "submenu_tag_suffix": "HELP"},
                ],
            }

        else:
            return {
                "menu_tag_suffix": "MAIN",
                "width": 110,
                "opt_spec_list": [
                    {"type": "submenu", "label": "Edit", "submenu_tag_suffix": "EDIT"},
                    {"type": "submenu", "label": "Help", "submenu_tag_suffix": "HELP"},
                ],
            }
开发者ID:hellios78,项目名称:TACTIC,代码行数:27,代码来源:gear_menu_wdg.py

示例15: get_display

# 需要导入模块: from pyasm.common import Environment [as 别名]
# 或者: from pyasm.common.Environment import get_security [as 别名]
    def get_display(my):
        security = Environment.get_security()
        if security.check_access("builtin", "view_site_admin", "allow"):
            menus = [my.get_main_menu(), my.get_add_menu(), my.get_edit_menu(), my.get_tools_menu(), my.get_help_menu()]
        else:
            menus = [my.get_main_menu(), my.get_edit_menu(), my.get_help_menu()]

        """
        btn_dd = DivWdg()
        btn_dd.add_styles("width: 36px; height: 18px; padding: none; padding-top: 1px;")

        btn_dd.add( "<img src='/context/icons/common/transparent_pixel.gif' alt='' " \
                   # "title='TACTIC Actions Menu' class='tactic_tip' " \
                    "style='text-decoration: none; padding: none; margin: none; width: 4px;' />" )
        btn_dd.add( "<img src='/context/icons/silk/cog.png' alt='' " \
                "title='TACTIC Actions Menu' class='tactic_tip' " \
                    "style='text-decoration: none; padding: none; margin: none;' />" )
        btn_dd.add( "<img src='/context/icons/silk/bullet_arrow_down.png' alt='' " \
                "title='TACTIC Actions Menu' class='tactic_tip' " \
                    "style='text-decoration: none; padding: none; margin: none;' />" )
        """

        from tactic.ui.widget import SingleButtonWdg

        btn_dd = SingleButtonWdg(title="Global Options", icon=IconWdg.GEAR, show_arrow=True)

        # btn_dd.add_behavior( { 'type': 'hover',
        #            'mod_styles': 'background-image: url(/context/icons/common/gear_menu_btn_bkg_hilite.png); ' \
        #                            'background-repeat: no-repeat;' } )
        smenu_set = SmartMenu.add_smart_menu_set(btn_dd, {"DG_TABLE_GEAR_MENU": menus})
        SmartMenu.assign_as_local_activator(btn_dd, "DG_TABLE_GEAR_MENU", True)
        return btn_dd
开发者ID:hellios78,项目名称:TACTIC,代码行数:34,代码来源:gear_menu_wdg.py


注:本文中的pyasm.common.Environment.get_security方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。