Skip to content

Instantly share code, notes, and snippets.

@joshbooker
Created September 1, 2017 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshbooker/f5b2aa754f45d1bb580e854563ee6bbc to your computer and use it in GitHub Desktop.
Save joshbooker/f5b2aa754f45d1bb580e854563ee6bbc to your computer and use it in GitHub Desktop.
/// <reference path="~/GeneratedArtifacts/viewModel.js" />
myapp.BrowseUsers.created = function (screen) {
// Write code here.
myapp.userPermissions = [];
screen.getUserPermissions().then(function (p)
{
p.data.forEach(function (p)
{
myapp.userPermissions.push(p.Name);
})
}).then(function ()
{
if (myapp.UserPermissions["Users_CanInsert"])
{
screen.findContentItem("AddUser").isEnabled = true;
}
else
{
screen.findContentItem("AddUser").isEnabled = false;
}
//if (myapp.UserPermissions["Users_CanUpdate"])
//{
// screen.findContentItem("EditUser").isEnabled = true;
//}
//else
//{
// screen.findContentItem("EditUser").isEnabled = false;
//}
})
};
myapp.BrowseUsers.beforeApplyChanges = function (screen) {
// Write code here.
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment