Example #1
0
    def get_one(self, workspace_id):
        user = tmpl_context.current_user
        workspace_api_controller = WorkspaceApi(user)
        role_api = RoleApi(tg.tmpl_context.current_user)
        user_api = UserApi(tg.tmpl_context.current_user)

        workspace = workspace_api_controller.get_one(workspace_id)
        role_list = role_api.get_roles_for_select_field()
        user_list = user_api.get_all()

        current_user_content = Context(CTX.CURRENT_USER).toDict(user)

        dictified_workspace = Context(CTX.ADMIN_WORKSPACE).toDict(workspace, 'workspace')
        fake_api_content = DictLikeClass(role_types=role_list, users=user_list, current_user=current_user_content)
        fake_api = Context(CTX.ADMIN_WORKSPACE).toDict(fake_api_content)

        return dict(result = dictified_workspace, fake_api = fake_api)
Example #2
0
    def get_one(self, workspace_id):
        user = tmpl_context.current_user
        workspace_api_controller = WorkspaceApi(user)
        role_api = RoleApi(tg.tmpl_context.current_user)
        user_api = UserApi(tg.tmpl_context.current_user)

        workspace = workspace_api_controller.get_one(workspace_id)
        role_list = role_api.get_roles_for_select_field()
        user_list = user_api.get_all()

        current_user_content = Context(CTX.CURRENT_USER).toDict(user)

        dictified_workspace = Context(CTX.ADMIN_WORKSPACE).toDict(workspace, 'workspace')
        fake_api_content = DictLikeClass(role_types=role_list, users=user_list, current_user=current_user_content)
        fake_api = Context(CTX.ADMIN_WORKSPACE).toDict(fake_api_content)

        return dict(result = dictified_workspace, fake_api = fake_api)
Example #3
0
    def get_one(self, user_id):
        current_user = tmpl_context.current_user
        api = UserApi(current_user)
        # role_api = RoleApi(tg.tmpl_context.current_user)
        # user_api = UserApi(tg.tmpl_context.current_user)

        user = api.get_one(user_id)  # FIXME

        role_api = RoleApi(tg.tmpl_context.current_user)
        role_list = role_api.get_roles_for_select_field()

        dictified_user = Context(CTX.ADMIN_USER).toDict(user, 'user')
        current_user_content = Context(CTX.CURRENT_USER).toDict(tmpl_context.current_user)
        fake_api_content = DictLikeClass(current_user=current_user_content,
                                         role_types=role_list)
        fake_api = Context(CTX.ADMIN_USER).toDict(fake_api_content)

        return DictLikeClass(result=dictified_user, fake_api=fake_api)
Example #4
0
    def get_one(self, user_id):
        current_user = tmpl_context.current_user
        api = UserApi(current_user )
        # role_api = RoleApi(tg.tmpl_context.current_user)
        # user_api = UserApi(tg.tmpl_context.current_user)

        user = api.get_one(user_id) # FIXME

        role_api = RoleApi(tg.tmpl_context.current_user)
        role_list = role_api.get_roles_for_select_field()

        dictified_user = Context(CTX.ADMIN_USER).toDict(user, 'user')
        current_user_content = Context(CTX.CURRENT_USER).toDict(tmpl_context.current_user)
        fake_api_content = DictLikeClass(current_user=current_user_content,
                                         role_types=role_list)
        fake_api = Context(CTX.ADMIN_USER).toDict(fake_api_content)

        return DictLikeClass(result = dictified_user, fake_api=fake_api)