Uploaded image for project: 'RH-SSO'
  1. RH-SSO
  2. RHSSO-2800

Authorization Policy: Cannot display realm Role

    XMLWordPrintable

Details

    • False
    • None
    • False

    Description

      1. Description:

      When creating a realm role Authz policy, the realm role created is not visible within the policy.

      This issue is due to a Javascript error

      ~~~
      angular.js:15635 TypeError: Cannot read property 'length' of undefined
          at authz-controller.js:1697
          at I (angular-resource.js:779)
          at angular.js:18013
          at m.$digest (angular.js:19180)
          at m.$apply (angular.js:19568)
          at k (angular.js:13411)
          at v (angular.js:13668)
      ~~~

      2. How to reproduce

      step1: 
      From a client --> Goto Authorization 

      step2: 
      Goto Policy and and select "Create Policy Role"

      step3: 
      Select one of the available Role
      Provide a policy Name
      Click Save

      The issue is that the created policy no longer displays the role used.

      3. Analysis:

      This error is occurring in the JavaScript of file authz-controller.js at line 1697:

      ~~~
      for (i = 0; i < $scope.clients.length; i++) {
                                  if ($scope.clients[i].id == data.containerId) {
                                      data.container = {};
                                      data.container.name = $scope.clients[i].clientId;
                                  }
                              }
      ~~~~

      It is due to the fact the $scope.clients.length can be undefined, thus causing the javascript exception seen here.

       

      4. WorkAround

      If you update within the file authz-controller.js the dailing line (1697), replacing it with 

      if (($scope !== undefined) && ($scope.clients !== undefined))

      The command will succeed.

       

       

      ~~~
       if (($scope !== undefined) && ($scope.clients !== undefined))
                          {
                                          for (i = 0; i < $scope.clients.length; i++) {
                                  if ($scope.clients[i].id == data.containerId) {
                                      data.container = {};
                                      data.container.name = $scope.clients[i].clientId;
                                  }
                              }
                          }
                              selectedRoles.push(data);
                              $scope.selectedRoles = angular.copy(selectedRoles);
                          });
                      }
                  }

      ~~~

       

       

       

       

       

       

      Attachments

        Activity

          People

            jkoops@redhat.com Jon Koops
            rhn-support-orivat Olivier Rivat
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: