We are using AngularJs , In our application we have around 8 roles like SUPER_ANDMIN, ADMIN,USER,RESELLER etc ,
so if user role is ADMIN , then 7 tabs show but if user role is USER , then only three tabs show , on every call we send role of user from server site.
so what is the best practice of it does we need to put ng-if on every tab or any better option in AngularJS
Thanks
You can either make a hybrid application creating multiple SPA's that define certain portions of functionality within your application or you can have one SPA with multiple views and restricting views based on your role.
In case of the latter you can use ui-router with data attached per view. Upon authentication you can determine the role and restrict the user from viewing certain pages.
I have a small example on plunker. Note that I haven't restricted the navigation in order for you to see that viewing the corresponding pages is prohibited nor is the authentication in any way a real implementation.
Related
The question is about the custom visualforce page in Salesforce. The page is created for getting contacts, opportunity, loans all are at a single dynamic link on the account named "Manage portal Access" Which comes under "Customer Portal Access" Tab like details and related list under "Account" Tab.The page was created to Manage the customer account, contacts and opportunities relationship. The page contains Email, Role, Last Login and a Toggle button as "Enabled".When this toggle button is enabled, those users have access to this portal relationship. It has respective apex class also.
The task here is, the toggle button can be enabled/disabled by some users, this want to be changed here by providing Read only access and assign two permission sets for edit access on this portal enable/disable.
" As a user I want Read Only Access to the portal tab. I want to be able to view all information on the tan and click through any dynamic links, but not be able to toggle the portal enable or un-portal enable any contacts. All Salesforce users should have a minimum of read only access to the Customer Portal Access Tab. The two permission below currently and should continue to provide edit access to the customer portal access section.
Create Customer Portal User
Document Manage Portal Admin "
Whether there is any customization option like providing access to objects in Salesforce through (Layouts, Fields FLS, Validation Rule)?
Or
-This can be achieved only through code on Visual force page and it's respective apex class, if this is the case how can I do it, whether there is any certain command or method for providing access or through controller class?
The "normal" object permissions (Create/Read/Update/Delete) and field level security (Read/Update) can be referenced in Visualforce. Something like this might be enough for you:
<apex:commandButton disabled="{!$ObjectType.Contact.fields.Role__c.updateable}">
Check the DescribeFieldResult in Apex reference. There's also something mentioned in VF developer guide but it's bit hidden and not as detailed: https://developer.salesforce.com/docs/atlas.en-us.234.0.pages.meta/pages/pages_variables_global_objecttype.htm
If you need more control than just whether field is editable or not - maybe look into Custom Permissions. They're your own checkboxes you add to Profile/Permission Set and you can check them in pure VF too, no apex required.
So... you decide. If most of the page is supposed to be identical, "just" about the button being enabled/disabled (or maybe even not rendered at all) - it's best to put the condition in the button. If it sounds like you need 2 different layouts - having 2 big blocks of code and one or another rendered might be cleaner to maintain and test.
P.S. Remember that good tester can activate the button using browser's developer tools. You should make similar "is field accessible / is custom permission assigned" check in Apex that runs on button click.
I want to show different views based on the user of my application for example if the user is admin he can see all the controls or when it is acting as user he can only see a subset of controls and UI and he can perform the limited action.
One solution that comes to my mind is sending the role information with the page as a JSON but that would require me to have knowledge of the logged in user so, basically I can first check if the user is logged in or not through the cookie? if no I can just load the lightweight version of the login page and after user logs in then I can send a new page altogether with user's profile information embedded in it.
The other approach that I see is that I can bootstrap my angular application and then check the login status and if the login is done, then bring the profile information through a JSON and update the view, but I think it would be slow and error-prone.
I don't know what is best / recommended approach.
First approach seems to be a better approach out of these 2.
Problem with the second approach is you are sending 2 requests to the server - one for login and then 2nd one to get the user role/profile. If you are choosing this approach then you may have few issues depending how are you going to implement it:
If you are updating your UI after login then you will have to decide what should be shown to the user since you don't know the user profile yet. Even if you come up with some minimal privilege UI, there will be another request to get the profile which will kind of refresh the UI again - 2 UI refreshes could be annoying for the user. Not to mention that there 2 requests going which could make your site slow.
If you decide not to update the UI after login but only after you get user profile, still the delay would be more as you will have to wait for response of 2 separate requests. Could be a major issue with slow networks(consider mobile)
If you are using the first approach, you'll get away with above mentioned problems.
When a custom form is created in Wagtail, I can see that it stores in the DB. What I'm not clear on is how to make it so that the admin UI contains the results in some manner. (A new link which lets you download a CSV would be fine, but I don't see how to do that)
How do I allow admin users the ability to see the results of the custom forms? Is this library the only way?
Once you create your first form page (i.e. a page of any page type that subclasses AbstractForm), a 'Forms' item will automatically appear in the left menu of the Wagtail admin. This provides a listing of all the form pages that exist on the site, allowing you to access the results of each one and download them as a CSV.
When i include a portlet in a page, i'm asked to customize the portlet.
Trying to do so, i have three options namely:
Edit Shared settings
Personalize &
Configure
What does each mean and How do they differ?
This is an old page but it still describes the differences correctly: http://publib.boulder.ibm.com/infocenter/wpdoc/v6r0/topic/com.ibm.wp.ent.doc/wps/adcfgplt.html
In short:
Configure: Changes made here affect all occurrences of the portlet on all pages for all users. The administration portlets allow you to create multiple copies of the same portlet with different administrator level configurations.
Edit Shared: Changes made here affect a particular instance of a portlet on a page and apply to all users who view that instance of the portlet on that page.
Personalize: Changes made here are associated with a single user and apply only to that particular user who views the portlet on the page. Only that user can make that update.
I need to have a custom widget on Salesforce Service Cloud Console. I don't really care where it is as long as it's easily accessible (kind of like the Softphone widget).
I need this for two reasons:
I need a quick way for users to change their "status" (a custom field on user).
I need to execute some custom javascript to hide certain elements from some page layouts.
Any idea if this can be done?
Note: when I say "Service Cloud Console" I mean this kind of console:
I think Custom Console Components may be what you are looking for? (Here is how to add them to the console once you made them. Note that after the 11 steps, it says 'Before you can access ...'.)
I have implemented similar thing using a custom console component , there you can add a visual-force page and add a button on it "Change Status". Once user clicks it get who is the logged in user .
String userid = UserInfo.getUserId()
rest is the simple logic to change the status on User record on the page controller.