Skip to Content
avatar image
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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

0 Answers