Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return a proper list of admin roles for contacts object #87

Open
asirota opened this issue Feb 27, 2021 · 2 comments
Open

Return a proper list of admin roles for contacts object #87

asirota opened this issue Feb 27, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@asirota
Copy link
Member

asirota commented Feb 27, 2021

Reference to enhancement request

The administrator role end point needs to have a comma delimited list, in alphabetical order of all admin roles granted.

Currently the admin role is assigned a hard coded value for administrator (full access) no matter what the admin roles are.

Here's an example structure that should be flattened into an alphabetical sorted string delimited with commas.

{ "FieldName": "Administrator role", "Value": [ { "Id": 2, "Label": "Membership manager" }, { "Id": 4, "Label": "Event manager" }, { "Id": 16, "Label": "Restricted website editor" }, { "Id": 32, "Label": "Newsletter manager" }, { "Id": 64, "Label": "Online store manager" } ], "SystemCode": "AdminRole" }

@asirota asirota self-assigned this Feb 27, 2021
@asirota asirota added enhancement New feature or request good first issue Good for newcomers labels Feb 27, 2021
@asirota
Copy link
Member Author

asirota commented Feb 27, 2021

Could use this array Walker

case "Groupparticipation":
                var result = "";
                member.FieldValues.forEach(function(e) {
                  if (e.SystemCode === "Groups") {
                    var values = e.Value;
                    for (var j = 0; j < values.length; j++) {
                      var value = values[j].Label;
                      result += (value || null) + ", ";
                    }
                  }
                });
                row.push(result.substring(0, result.length - 2));
                break;

@asirota
Copy link
Member Author

asirota commented Feb 27, 2021

Use this code snippet to create comma separated string

var arrayObjects = [
  {
    property1: "A",
    property2: "1"
  },
  {
    property1: "B",
    property2: "2"
  },
  {
    property1: "C",
    property2: "3"
  }
];

Array.prototype.map.call(arrayObjects, function(item) { return item.property1; }).join(",");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant