I am working on a multi user, multi group app where a user could be one of 3 types of user in a group. We have a screen that places into app storage the group the user is browsing screens as. I am trying to show hide the plus button on the list component for the managing user of the group and this user group can not be an app admin
I was loosely following this tutorial:
It seems to be inconsistent on when it works.
So let me explain a little more what I am needing. The logged in user may only have permission to make changes for a certain group. I have 2 user data sources. The first (1) is the data source that stores the login information for the app users. The second DS (2) contains the information that user has for each of the groups they are assigned to. So for example if in the second DS a user’s ‘User Type’ is ‘leader’ or ‘leaderassistant’ I want the plus button to show. However the same user when looking at a different group their ‘User Type’ may NOT be ‘leader’ or ‘leaderassistant’ so I would NOT want the button to show. Here is the full JS that I was trying.
Fliplet.App.Storage.get(‘group_id’).then(function (group_id) {
return Fliplet.App.Storage.get(‘user_id’).then(function (user_id) {
return Fliplet.DataSources.connect(358653).then(function(connection) {
return connection.findOne({
attributes: [‘User Type’],
where: { uid: user_id, Group: group_id }
});
}).then(function(newRecords) {
if(newRecords.data[‘User Type’] == ‘leaderassistant’ || ‘leader’){
$(‘.coachPerms’).fadeIn(500);
}else{ }
});
});
});