Show different modules dependence on user role - asp.net-web-api

I uwrite app and now i have question - lets say i write app for restaurant.
And i need that this app can login chief and waiter and restaurant owner
Now chief need see only orders.
And waiter need see orders, and table.
and owner need see orders, money tables and lets say count of people
So we have Money, orders, table, people modules.
So I don't want to write for each "player" app - I want all modules in 1 app but to do like [Attribute] for pages.
I come from .NET web - so in WebAPI I just put [Authorize(Roles="Owner")] for example
But i dont find example how i can do something like it in xamarin
Thank you

There is no built in mechanism to do this in Xamarin. You would need to code this yourself in your app based on whatever security/role mechanism that you are using.
If you are using MVVM navigation it should be fairly easy to add this sort of check into your navigation mechanism so that users are not allowed to navigate to pages they are not authorized to view.

Related

Enable / disable functionalities for users on Ms Teams custom App

I'm planning to build a custom application for Ms Teams and I wanted the app to have an 'Administration' context, reserved for some users, with charts and records management that the rest of the users wouldn't be able to see. Is there a way to accomplish this?
Is it possible to hide tabs depending on a user profile? Is there another way to accomplish this on teams?
Tks
Inside your tab you can do whatever you want - it's just a custom web app/page. The only "restriction" aside from a normal web app, is that it must implement the Teams javascript library - see here for more. However, once you've implemented that library, you can get the Teams context, which includes the user's Azure AD Id and also UPN, and you could use one or both of those to do a lookup against your database, determine the user's role, and show/hide UI elements accordingly.
However, I think you might be asking about whether the entire Tab -itself- (i.e. even the tab item inside the Teams client) can be hidden from other users. To do this, an option is to use a "private channel", just for the relevant users, and pin the tab inside there only.

Add cart functionality to API or to Client?

I am creating an e-commerce API using the Django Rest Framework. The API will handle the following areas:
Databases
User Registration
Permissions
Orders/Payments
There's still one area in which I'm not quite sure how to implement in my project. It's the cart functionality. Would it be better to implement it on the client-side (ex: React/Ember) or on the server-side (i.e. API)?
One scenario that confused me is if the user is logged in in different platforms (ex: Website and mobile app). I want the user to have the same cart on mulitple platforms.
In that particular use case, if you want cart persistence then it must be backend. The reason for this is one being able to have a single source of truth. The phone app and the web app cannot talk to each other unless they have some sort of "common ground" between them.
That's where the API comes in. It will allow both ends to speak to each other by having the API as the single source of truth. See my terrible diagram for a visual.

Mix Panel API web segmentation and personalisation

Hi I am interested in using Mix Panel on a web site to track customers events. I would like to know if there is any way to use the api to personalise the web site per customer, similar to segmentation for emails.
I would like to query the api for a singular customer asking whether they have achieved several events.
For example something like
If customer has clicked out and last visit greater than a month ago display a banner advert.
Mixpanel does not seem like a correct tool for the job you describe here.
While theoretically this might be possible (via Mixpanel's HTTP API), this will create unnecessary architectural complexity and add extra latency. If you need to customize your web site per user, store any user state in a database like MySQL or PostgreSQL. This will be both faster and easier.

Creating an API for LUIS.AI or using .JSON files in order to train the bot for non-technical users

I have a bot that uses .NET, MS Bot Framework and LUIS.ai for its smarts.
All's fine, except that I need to provide a way for non-technical users to train the bot and teach it new things, i.e. new intents in LUIS.ai.
In other words, suppose that right now the bot can answer messages like "hey bot where can i get coffee" and "where can I buy some clothes" with simple phrases containing directions. Non-technical users need to be able to train it to answer "where can I get some food" too.
Here's what I have considered:
Continuing to use LUIS.ai. Doesn't work because LUIS.ai doesn't have an API. The best it has is the GUI to refine existing intents, and the upload app/phrase list feature. The process can be semi-automated if the JSON file with the app can be generated by some application that I write; however, there still needs to be backend code that handles the new intents, and that has to be implemented by a C# coder.
Could it work if I switch from C# to Node.js? Then theoretically I would be able to auto-generate code files / intent handlers.
Azure Bot Service. Seems it doesn't have a non-technical interface and is just a browser-based IDE.
Ditching Bot Framework entirely and using third-party tools such as motion.ai. Doesn't work because there's no "intellect" as the one provided by LUIS.ai.
Using Form Flow that's part of Bot Framework. If my GUI bot builder application can generate JSON files, these files can be used by Bot Framework to build a bot automatically. Doesn't work because there's no intellect as in LUIS.ai.
Keep using Bot Framework, but ditch LUIS and build a separate web service based on a node.js language processing library for determining intents. May or may not work, may be less smart than LUIS, and could be an overkill.
Override the method in LuisDialog that selects the intent from the LuisResponse, in order to use the my own way to decide the intent (but how?).
At this point I'm out of ideas and any pointers will be greatly appreciated.
First of all, LUIS.ai provides an API that you can use to automatize the training. Moreover, here is Luis Trainer written entirely in Python against the API that just does that.
The easiest one, probably is the one you are describing in #1: you can automatize the training (as explaining above) but you will still have to deploy a new version of the bot if new intents are being provided. One thing is letting users to train an existing model with new utteraces and another completely and different thing is to let them create the model :)
It might be hard to skip having to write the backend code (I wouldn't automatize that at all)
Here is a potential idea (not sure if it will work though). You would need 2 Luis models.
One with your current model, that users will be able to train with new utterances.
The second model, is one exclusively intended to be "expanded" with new intents by users.
If you separate this in that way, you might be able to look into a "plugin" architecture for the second LUIS model. So, your app, somehow, loads dinamically an assembly where the second model lives.
Once you you have that in place, you can focus on writing the backend code for your second Luis Model without having to worry about the bot/first model. You should be able to replace the assembly with the second Luis Model and be able in the bot to detect if there is new version of that assembly and replace the current one in the app domain.
As I said, is just an idea as I'm brainstorming with you. Sounds a bit complex, and it's not addressing all your concerns; as you still will need to write code (which in any case, you will eventually have to do)
I am working through a challenge project (training) to automate the creation of Chat Bots specifically targeted against a Luis.ai model using plain old javascript and web services to Luis.
I looked at the Bot Framework and it's just too cumbersome to automate (I want X number of customers to create a Chat Bot without coding). I also want to add my own type of 'Cards' (html widgets) that do more and can be easily configured by someone with zero coding skills.
Calls to the Luis.ai/Cognitive Services API are made in my code behind and the json response returned to my own rules engine. On the following URL click the LUIS API link on the page to open the Luis API Console where you can test, and train your Model. All the endpoints you will need are here...
https://dev.projectoxford.ai/docs/services/
Based on the various endpoints on that page, you can use WebClient in asp.net to pull back the response. So in my testing I have buttons on a page to push utterances up to the model, pull back entities, create hierarchical entities and so on. Have a look at http://onlinebotbuilder.com to see how an intent of product dynamically inserted a shopping cart.
When your tool is built and utterances start to arrive, Luis.ai will store them and via the Suggest tab (at Luis.ai) it will ask you for guidance...Unfortunately I don't think you could give that control over to your customers, unless they are experts in your domain (they understand which utterance belongs to which intent). You don't need to take your app down, just train it periodically to improve the Model based on your customers input...soon enough you will have your model working well based on your intents.
Hope that helps.

Website information update system?

I have developed a student portal website for my college using Joomla 2.5 and now I want some mechanism to regularly update information on it.
My problem is that there are many societies in my college that organize events frequently and it is next to impossible to get their information on time to be updated on the site.
Is there some way possible by which those people can independently upload their events on the site without the administrator's interference and also without messing up with other facilities of the back-end?
The whole point of a CMS is to make things like this easier. As #emmanuel points out this is why there are extensions, you should use a calendaring extension.
In my experience one of the simplest things you can do if most people on your campus have Google accounts is to create a shared Google calendar that you give create access to for a representative of each club. Then embed that calendar on your site with one of the extensions for that. That way you don't have to deal with accounts on your site at all. There are a lot of ways to make it more complicated (like let each club have their own calendar and then you make a master calendar) but I think that could end up being more of a headache.
The biggest problem with calendars is getting people to list their events, because it is work for them. Sites with big empty calendars don't look very good. So you may want to make sure you have some events by finding out if there are some repeating events that you can set up.
You could try jevents component: http://www.jevents.net/
You could grant permissions to your sub admin users and add / edit / delete their events from the front end without giving them access to the backend of your site.

Resources