Skip to Content
author's profile photo Former Member
Former Member

sapui5 api Roles

Hello Everyone ,

i am making an app on role assignment .

My Requirement is that i have to fetch the groups from portal sub-account , and then all apps in that subaccount and then which role is assigned to which app .

and then i have to bind that role in my table view. which role is already assigned to app under that role i have to make a switch button to yes otherwise no , and i can also change the roles from view . so how i can fetch the groups and role .

i am using that code to fetch , please tell me the correct code how i can get that ,

	_getGroups: function (aData) {
			var that = this;
			$.ajax({
				url: "/ApiRoles/accounts/jtao4bfd54/users/groups?userId=" + aData.name,
				type: "GET",
				success: function (groups, XMLHttpRequest) {
					for (var i = 0; i < groups.groups.length; i++) {
						that._getRoles(groups.groups[i].name);
					}


				}
			});
		},



	_getRoles: function (group) {
			var that = this;


			var data = [];
			var roleData = {
				"dealerFlag": false,
				"empFlag": false
			};
			this.roleModel = new sap.ui.model.json.JSONModel(roleData);
			this.getView().setModel(this.roleModel, "role");


			$.ajax({
				url: "/ApiRoles/accounts/jtao4bfd54/groups/roles?groupName=" + group,
				type: "GET",
				success: function (roles, XMLHttpRequest) {
					for (var i = 0; i < roles.roles.length; i++) {
						if (roles.roles[i].providerAccount == "portal") {
							data.push(roles.roles[i]);
						}
					}


					for (var i = 0; i < data.length; i++) {
						if (data[i].name == "Dealer") {
							roleData.dealerFlag = true;
						} else {
							roleData.empFlag = true;
						}
					}


					that.roleModel.refresh(true);
					sap.ui.core.BusyIndicator.hide();
				}
			});


		},

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.