Skip to main content
1 个回答
  1. 2021年1月27日 17:56

    Does anyone had made it?

    I do have a set of groups defined on Default Project/Default Site, and would like to replicate the permissions I have on each one to other Projects.

     

    The attached picture is the set of permissions I want to transpose.

     

    Below is the code, and the results I can get from it...

    Does anyone had made it?I do have a set of groups defined on Default Project/Default Site, and would like to replicate the permissions I have on each one to other Projects.with server.auth.sign_in(tableau_auth):

      print("Connected to Site: ", site_url)

       

      endpoint = server.projects

      all_project_items = list(TSC.Pager(endpoint, request_option))

         

      for project in all_project_items:         

        #get permissions from Projects (related to Groups and Users)     

        if project.name == 'Default':

          project_Default = project

          break

           

      print(project_Default.name)

       

      server.projects.populate_permissions(project_Default)

               

      #List Groups

      endpoint = server.groups

      all_groups = list(TSC.Pager(endpoint, request_option))

      for group in all_groups :

        print(group.name)

         

      print("")

      ⌗Validate the User Group is related to the Project         

      for permission in project_Default.permissions:           

          

        ⌗ProjectLeader Group           

        for capability in permission.capabilities:

         

          for group in all_groups:

            ⌗ProjectLeader Groups

            if group.id == permission.grantee.id:

              print(group.name, " - ", capability, " - ", permission.capabilities)   

     

    ############################

    RESULT

    ############################

    Connected to Site:  

    Default

    All Users

    forge rock

    Project_Owners

    Project_Analysts

    Project_Viewers

     

    All Users - Read - {'Read': 'Allow'}

    Project_Owners - ProjectLeader - {'ProjectLeader': 'Allow'}

    Project_Analysts - Read - {'Read': 'Allow'}

    Project_Viewers - Read - {'Read': 'Allow'}

0/9000