Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions rockstar/rockstar.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
directoryPerson();
} else if (location.pathname == "/admin/groups") {
directoryGroups();
} else if (location.pathname.match("/admin/group/")) {
directoryGroup();
} else if (location.pathname == "/admin/access/admins") {
securityAdministrators();
} else if (location.pathname.match("/report/system_log_2")) {
Expand Down Expand Up @@ -339,6 +341,38 @@
});
}

function directoryGroup() {
var groupId = location.pathname.split("/")[3];
var group;
getJSON(`/api/v1/groups/${groupId}`).then(aGroup => {
group = aGroup;
$(".subheader").html(`${e(group.profile.name)}`);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no element with this css class. it exists for Users, but not for Groups

document.title += ` - ${e(group.profile.name)} ${e(group.profile.description)}`;
});
function showGroup() {
function toString(o, i = '') {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code for toString was copied and pasted from showUser. it should be factored out.

also, indentation should be cleaned up

const strings = [];
for (const p in o) {
if (p == "_links") continue;
var v = o[p];
if (v === null) v = "null";
else if (typeof v == "string") v = '"' + v.replace(/(["\\])/g, "\\$1") + '"'; // Escape " and \
else if (Array.isArray(v)) v = v.length == 0 ? '[]' : "[\n" + toString(v, i + " ") + i + "]";
else if (typeof v == "object") v = $.isEmptyObject(v) ? '{}' : "{\n" + toString(v, i + " ") + i + "}";
if (!Array.isArray(o)) v = p + ": " + v;
strings.push(i + v);
}
return strings.join("\n") + "\n";
}
const groupPopup = createPopup("Group");
// It'd make sense to add group logos in here, however, if it's not `OKTA_GROUP`, it's `APP_GROUP` -so, no distinction between AD, Slack, etc.
// const logo = group.type == "OKTA_GROUP" ? "okta" : group.type.toLowerCase();
groupPopup.html(`</span><br><pre>${e(toString(group))}</pre>`);
Copy link
Copy Markdown
Owner

@gabrielsroka gabrielsroka Feb 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has an extra </span><br>

}
createDiv("Show Group", mainPopup, showGroup);
createPrefixA("<li class=option>", "<span class='icon person-16-gray'></span>Show Group", ".okta-dropdown-list", showGroup);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this adds an item to the More Actions menu which exists for Users, but not for Groups

}

function securityAdministrators() {
createDiv("Export Administrators", mainPopup, function () { // TODO: consider merging into exportObjects(). Will the Link headers be a problem?
const adminsPopup = createPopup("Administrators");
Expand Down