I'm struggling to get a field to be enabled and/or visible based on user's role in Google App Maker.
I'm assigned to the Admins role and am trying to get the field to enable and/or visible if an Admin is the user of the page.
On the object i've added the below to the enabled and visible option
#user.roles ? "Admins"
but it's permenantly disabled. I've tried testing as both preview and published versions. I've also tried seeing it as #user.roles ? Admins and it still stays disabled.
Any ideas?
It should be (#user.roles).indexOf('Admins') > -1. Bracket placement seems to be very particular when using visibility or enabled when using a binding in app maker.
Try to set binding to:
(#user.roles).indexOf('Admins') > -1
Related
I have wso2am4.0.0 and run success.
I want to change the textbox to drop down box of the Roles of basic info page (https://localhost:9443/publisher, Develop > Basic Info) , like image below.
How do I modify the source code of carbon-apimgt to make this change?
The publisher portal code can be found here - https://github.com/wso2/carbon-apimgt/tree/v9.0.174/features/apimgt/org.wso2.carbon.apimgt.publisher.feature
AFAIK, it's not possible. For that, you need to populate the existing roles list. Current publisher Rest API does not have such a resource to populate the role list and it only contains a validation resource[1].
[1] - https://apim.docs.wso2.com/en/latest/reference/product-apis/publisher-apis/publisher-v2/publisher-v2/#tag/Roles
I am building a console and have successfully rendered my iframe:
gapi.load('gapi.iframes', function() {
var options = {
'url': 'https://play.google.com/work/embedded/search?token=' + data + '&mode=SELECT',
'where': document.getElementById('container'),
'attributes': { style: 'width: 950px; height:500px', scrolling: 'yes'}
}
However, when I select an app using the provided SELECT button, it only returns the expected payload. I assumed that the iframe would do the heavy lifting here but now know that I need to build the logic. Can someone point me in the rightt direction here for approving the app via SELECT button? Is there a set of iframe events that I should be writing this with in mind? I'm completely lost since documentation here https://developers.google.com/android/management/apps#select-button_1
is extremely vague. Has anyone had issues with this before?
Thanks!
The documentation for the select button indicates that “You need to specify the action that takes place when the IT admin clicks this button”. It is up to the EMM to decide what to do next. You could prompt the user to approve the app on play.google.com/work
For example, you need to approve dropbox. You need to login with your enterprise account then go to this link https://play.google.com/work/apps/details?id=com.dropbox.android and then approve the app.
Or you could prompt the user to add the application to a policy, which automatically approves the app for use by the user’s enterprise.
You may refer to this link for more information about handling iframe events.
I'm relatively new to GTM and have been experimenting with the new interface which will be fully replacing the original on 1 April: https://support.google.com/tagmanager/answer/4605576.
However, I have encountered some issues getting Google Analytics to register pageviews when testing on a local address. There is a solution for this using the original GTM layout outlined here:
Track localhost on Analytics in Google Tag Manager, so I don't wish to ask a duplicate question. However, in the new Google Tag Manager design there is no longer an option to set Cookie Domain to 'none', so how could I now test Google Analytics and GTM from a local address?
If you go to "fields to set", click on "add new field" and start typing into the "field name" input box the autosuggest function will suggest applicable field names (i.e. if you start typing "coo" it will suggest everything related to cookies, including the cookie domain).
"Behind the scenes" GTM has always used the "set fields" mechanism of GA, this has now been made explicit in the interface. But this does make a difference to the way GA tracking works, so simply "set field"->"cookieDomain" to "none" and everything will work like before.
Rather than modifying your tags to add/remove cookieDomain when moving between localhost and yourdomain.com I do the following to set cookieDomain automatically based on hostname.
Create a custom JS variable that will be used to set the value of cookieDomain.
Variable Name: XYZ-JS-CookieDomain (or whatever your naming convention is)
Type: Custom JavaScript
Code (the debug stuff is how I do all my custom JS variables, it's not required):
function() {
var result = {{Page Hostname}} == 'localhost'
? 'none'
: 'auto';
if ({{Debug Mode}}) {
console.warn('XYZ-JS-CookieDomain', result);
}
return result;
}
Configure the Tag.
More Settings > Fields To Set
Field Name: cookieDomain
Value: {{XYZ-JS-CookieDomain}}
Now when you run from localhost cookieDomain will be set to "none" and anywhere else it'll be "auto".
I guess you don't need to do any of these things now. cookieDomain is set to "auto" by default.
I want to notify the administrator when the user change his profile (for example, change his pseudo, his avatar and other custom fields attached to the user(People > Account settings > Add a new field) )
Thanks in advance !
I think the perfect module for this would be rules . There is a lot of docu on the project page.
Event:
Create a new rule on event user update
Condition
add condition (check for modifications..)
Result
trigger email
A user might be in role X.
There exist a view, where display A is allowed for role X while display B is restricted.
How do i programmatically check whether a user belonging to role X can access the display or not?
What you should do, is to check the permission instead of the role using: user_access
Is there a specific reason why you want to do this programmatically? You can set access rules for Views displays in the Views UI:
Edit the view, select the display and look for "Access" in the "Basic settings" block. Click the value (default = "Untrestricted"), click the "Override" button to override the setting for that specific display and choose the settings you need.
Can be implemented inline in the theme, but better to break it up into module + theme. (assumes drupal-7) In your theme (node--contenttype.tpl.php) invoke a custom access method:
if (module_invoke('hottopicresearch', 'display_moderated_research_access_callback', 'update', $node)) {
Implement an this access callback in a module:
function hottopicsresearch_display_moderated_research_access_callback($permission, $node) {
And check roles
if (in_array("editorial board admin", $user->roles) || $user->uid == 1) {
and/or node access as noted in other answers:
if (!node_access($permission, $research_parent_node)) {
returning TRUE or FALSE.
This example gave access to people with 'editorial board admin' role and people who can write to the node. Nobody else can see the index. Of course this doesn't stop them accessing the node directly.