Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Dec 10, 2024
1 parent 3b96d0d commit 64a50d3
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ qx.Class.define("osparc.store.Groups", {
return null;
},

getGroupMemberByUsername: function(orgId, username) {
const org = this.getGroup(orgId);
if (org) {
return org.getGroupMemberByUsername(username);
}
return null;
},

getGroupMemberByLogin: function(orgId, userEmail) {
const org = this.getGroup(orgId);
if (org) {
Expand Down Expand Up @@ -330,18 +338,18 @@ qx.Class.define("osparc.store.Groups", {
// CRUD GROUP

// CRUD GROUP MEMBERS
addMember: function(orgId, newMemberUserName, newMemberEmail = null) {
addMember: function(orgId, username, email = null) {
const gid = parseInt(orgId);
const params = {
url: {
"gid": gid
},
data: {},
};
if (newMemberEmail) {
params.data["email"] = newMemberEmail;
if (email) {
params.data["email"] = email;
} else {
params.data["userName"] = newMemberUserName;
params.data["userName"] = username;
}
return osparc.data.Resources.fetch("organizationMembers", "post", params)
.then(() => {
Expand All @@ -350,7 +358,7 @@ qx.Class.define("osparc.store.Groups", {
return this.__fetchGroupMembers(gid);
})
.then(() => {
const groupMember = this.getGroupMemberByLogin(gid, newMemberEmail);
const groupMember = email ? this.getGroupMemberByLogin(gid, email) : this.getGroupMemberByUsername(gid, username);
if (groupMember) {
return groupMember;
}
Expand Down

0 comments on commit 64a50d3

Please sign in to comment.