ui5_easy_use
Version:
CLI tool for SAP ui5 and SAPUI5 projects to initialize apps, generate pages, insert form and table components, manage routing, and automate i18n bindings
24 lines (20 loc) • 654 B
JavaScript
sap.ui.define([], function () {
"use strict";
return class AccessControl {
constructor(component) {
this._componentJS = component;
this.authService = this._componentJS.authService;
}
canAccess(feature) {
const userModel = this.authService.userModel;
const user = this.authService.getUser();
if (!user) {
return false;
}
const features = Array.isArray(feature) ? feature : [feature];
return features.some(function (role) {
return userModel.hasRole(role);
});
}
};
});