JHipster Authority Operations doesn't work - angularjs

I am using JHipster to develop my project with Angular1.
I want to hide some buttons etc. for security.
'*jhiHasAnyAuthority'
command works for Angular2+ project but i am using Angular1 and i don't know how to hide elements according to authority.
Also i saw in navbar.html
has-authority="ROLE_ADMIN"
are used by default to hide admin menu. When i try to use same command for my entity, nothing changes.

There is a similar question as yours which was nicely answered here
I myself have used both has-authority="" and has-any-authority="" and as an example of your query on the navbar.html, let's assume you have created an entity named Manager, this will be only visible after login from a ROLE_MANAGER or ROLE_ADMIN.
<li ui-sref-active="active" has-any-authority="ROLE_MANAGER, ROLE_ADMIN">
<a ui-sref="manage" ng-click="vm.collapseNavbar()">
<span class="glyphicon glyphicon-flash"></span>
<span class="hidden-sm" data-translate="global.menu.entities.manager">Manager</span>
</a>
</li>
Note: ROLE_MANAGER is a customer role added by me and not by the default jhipster generator.

Related

Angular variable on product price page throws error on google structured tool

I have cshtml page for rendering products information.I have used micro data in the page .As I use angular variable to display the price, google structured data tool is throwing exception.
{{productData.retailPrice}} is not a valid price specification.
As I use angular variable to display the price, google structured data tool is throwing exception.
<span ng-cloak ng-if="productData.selectedItem.SingleUnitPrice > productData.customProductPrice.customPrice"> <span itemprop="priceCurrency" content="CAD">$</span><span itemprop="price" class="lineThruRegPrice">{{productData.selectedItem.SingleUnitPrice}}</span>
<span itemprop="priceCurrency" content="CAD">$</span>
<span class="salePrice">{{productData.customProductPrice.customPrice}}</span>
</span> <span ng-cloak ng if="productData.customProductPrice.customPrice==productData.selectedItem.RetailPrice">
<span itemprop="priceCurrency" content="CAD">$</span><span itemprop="price">{{productData.customProductPrice.customPrice}}</span>
</span>
I expect the angular variable value to be read by google bot instead of the variable. Is the delay in evaluating the angular variable could cause this issue?
The Structured Data Testing Tool has very limited ability to deal with JavaScript. I presume the true value is added by JavaScript and the tool does not see that.
You can now test Product markup on pages from within the Google Search Console. Do a URL Inspection on the page in question. It will show what Product markup Google sees.
You can then do Live tests to see how recent edits affect things.
This tool is based on Googlebot and renders pages in the same way.

Ionic App - Cordova inApp Browser

I have created an ionic android app that reads data from the database. One of the fields in the database is the website url. I'm doing data binding where I can display the url using: {{accommodation.website}}. I want to be able to use this to display an external web page. Unfortunately this is not working using this code:
<a ng-href="#" target="_self" onclick="window.open('{{accommodation.website}}','_self','location=yes')" class="button button-positive">Website</a><p>{{accommodation.website}}</p>
and as a result it displays :
http://localhost:8100/%7B%7Baccommodation.website%7D%7D
Cannot GET /%7B%7Baccommodation.website%7D%7D
But when I use:
<a ng-href="#" target="_self" onclick="window.open('http://www.w3schools.com/angular/ng_ng-href.asp','_self','location=yes')" class="button button-positive">Website</a><p>{{accommodation.website}}</p>
It works fine on android phone. Instead of hard coding the url, I want to use data binding as I am working with ion-list. I spent all day trying to fix this. Please help.
Hope this will help you, for detail, go to Nic's Blog, and check out comments. Regards!
<a ng-href="{{accommodation.website}}" target="_self" onclick="window.open(this.href,'_self','location=yes')" class="button button-positive">Website</a><p>{{accommodation.website}}</p>
First, use ng-click, not onclick, but that is beside the point since you should just be using ng-href="{{accommodation.website}}"

how can i Google + sign in in angular js

I am new in angular js. In the last few days i am trying to log in into my app using google account. Using html google+ button i have successfully done that using javascript. Bellow showing part of implemented code that is on simple (html+javascript).
<span id="signinButton">
<span
class="g-signin"
data-callback="signinCallback"
data-clientid="389760997134-uredjv5rat0k3vsjaqlt7nn4pbgtqrat.apps.googleusercontent.com"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schema.org/AddAction"
data-scope="https://www.googleapis.com/auth/plus.me">
</span>
</span>
When trying that in angular i dont have any idea what what to do. Please give mw some idea what to do. I did not find anything clear over the internet. Any tutorial link or any partial project.

Why do they add a # sign in routing angular apps?

Ex from http://viralpatel.net/blogs/angularjs-routing-and-views-tutorial-with-example/
<ul class="nav">
<li> Add New Order </li>
<li> Show Order </li>
</ul>
AngularJs is a framework that uses html, css, and Javascript in order to easily create single-page applications.
Single-page applications are websites which fit on a single web page, in order to give the user a more fluid experience. All of the necessary code (html, Javascript etc.) is loaded all at once, and additional items are loaded from the server as necessary. The page does not need to be refreshed.
The "#" symbol in html tells the page to redirect to another section on that page. Since AngularJs works with single page applications, the "#" is telling the application to redirect and route to a new page view from within the webpage.
http://en.wikipedia.org/wiki/Single-page_application
http://scotch.io/tutorials/javascript/single-page-apps-with-angularjs-routing-and-templating

CKEditor in Drupal adding "nofollow" and target ="_blank" to every link

Even if I set the target to _self in CKEDitor. It is putting this into every link, it seems to be the default and override any other setting the user picks. In CKEDitor source view it will not show _target="blank" but when the node is published the link turns into this.
a link looks like this
<a target="_blank" rel="nofollow" href="#" style="color: rgb(85, 26, 139); text-decoration: none;">submitting an online application</a>
http://screencast.com/t/BEbaMw8SZ
I downloaded the latest CKEditor Full Package and am using it with the Drupal module.
UPDATE: I changed to TINYMCE and am getting the same issue so this is an issue with Drupal not CKEditor
Are you using any module that alters links like External Links, External Links Filter etc? Check that.
The same was happening to me. My problem was with Twitter module.
I've solved it unchecking the Twitter link converter filter in the format that was experimenting this problem (Filtered HTML in my case). This filter was adding "target=_blank" to all of my links.
Hope it helps.
You may have this set in the format you have set for the wysiwyg editors. Check admin/config/content/formats/wysiwyg_editor and make sure that in 'Limit allowed HTML tags' the 'Add rel="nofollow" to all links' option is not checked.

Resources