zeppelin git commit: ZEPPELIN-1164: backport new Shiro realm to 0.6 branch

2016-08-19 Thread bzz
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.6 c1bef -> 9c5ae39cc


ZEPPELIN-1164: backport new Shiro realm to 0.6 branch

Just a backport of #1173

Author: Anthony Corbacho 

Closes #1344 from bzz/branch-0.6-add-realm and squashes the following commits:

fbf8615 [Anthony Corbacho] [ZEPPELIN-1164] ZeppelinHub Realm


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/9c5ae39c
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/9c5ae39c
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/9c5ae39c

Branch: refs/heads/branch-0.6
Commit: 9c5ae39ccc154beac92c08c6a82e032e153e80d1
Parents: c1b
Author: Anthony Corbacho 
Authored: Fri Jul 22 15:55:50 2016 +0900
Committer: Alexander Bezzubov 
Committed: Fri Aug 19 18:21:58 2016 +0900

--
 conf/shiro.ini  |   5 +
 docs/security/shiroauthentication.md|  47 -
 .../apache/zeppelin/realm/ZeppelinHubRealm.java | 199 +++
 3 files changed, 249 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/9c5ae39c/conf/shiro.ini
--
diff --git a/conf/shiro.ini b/conf/shiro.ini
index ced9776..e774624 100644
--- a/conf/shiro.ini
+++ b/conf/shiro.ini
@@ -42,6 +42,11 @@ user3 = password4, role2
 #ldapRealm.userDnTemplate = uid={0},ou=Users,dc=COMPANY,dc=COM
 #ldapRealm.contextFactory.authenticationMechanism = SIMPLE
 
+### A sample for configuring ZeppelinHub Realm
+#zeppelinHubRealm = org.apache.zeppelin.realm.ZeppelinHubRealm
+## Url of ZeppelinHub
+#zeppelinHubRealm.zeppelinhubUrl = https://www.zeppelinhub.com
+#securityManager.realms = $zeppelinHubRealm
 
 sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
 

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/9c5ae39c/docs/security/shiroauthentication.md
--
diff --git a/docs/security/shiroauthentication.md 
b/docs/security/shiroauthentication.md
index 733ff11..f698a0a 100644
--- a/docs/security/shiroauthentication.md
+++ b/docs/security/shiroauthentication.md
@@ -101,6 +101,49 @@ finance = *
 group1 = *
 ```
 
-All of above configurations are defined in the `conf/shiro.ini` file.
+## Configure Realm (optional)
+Realms are responsible for authentication and authorization in Apache 
Zeppelin. By default, Apache Zeppelin uses 
[IniRealm](https://shiro.apache.org/static/latest/apidocs/org/apache/shiro/realm/text/IniRealm.html)
 (users and groups are configurable in `conf/shiro.ini` file under `[user]` and 
`[group]` section). You can also leverage Shiro Realms like 
[JndiLdapRealm](https://shiro.apache.org/static/latest/apidocs/org/apache/shiro/realm/ldap/JndiLdapRealm.html),
 
[JdbcRealm](https://shiro.apache.org/static/latest/apidocs/org/apache/shiro/realm/jdbc/JdbcRealm.html)
 or create [our 
own](https://shiro.apache.org/static/latest/apidocs/org/apache/shiro/realm/AuthorizingRealm.html).
+To learn more about Apache Shiro Realm, please check [this 
documentation](http://shiro.apache.org/realm.html).
+
+We also provide community custom Realms.
+
+### Active Directory
+TBD
+
+### LDAP
+TBD
+
+### ZeppelinHub
+[ZeppelinHub](https://www.zeppelinhub.com) is a service that synchronize your 
Apache Zeppelin notebooks and enables you to collaborate easily.
+
+To enable login with your ZeppelinHub credential, apply the following change 
in `conf/shiro.ini` under `[main]` section.
+
+```
+### A sample for configuring ZeppelinHub Realm
+zeppelinHubRealm = org.apache.zeppelin.realm.ZeppelinHubRealm
+## Url of ZeppelinHub
+zeppelinHubRealm.zeppelinhubUrl = https://www.zeppelinhub.com
+securityManager.realms = $zeppelinHubRealm
+```
+
+> Note: ZeppelinHub is not releated to apache Zeppelin project.
+
+## Secure your Zeppelin information (optional)
+By default, anyone who defined in `[users]` can share **Interpreter Setting**, 
**Credential** and **Configuration** information in Apache Zeppelin. 
+Sometimes you might want to hide these information for your use case. 
+Since Shiro provides **url-based security**, you can hide the information by 
commenting or uncommenting these below lines in `conf/shiro.ini`.
+
+```
+[urls]
+
+/api/interpreter/** = authc, roles[admin]
+/api/configurations/** = authc, roles[admin]
+/api/credential/** = authc, roles[admin]
+```
+
+In this case, only who have `admin` role can see **Interpreter Setting**, 
**Credential** and **Configuration** information. 
+If you want to grant this permission to other users, you can change **roles[ 
]** as you defined at `[users]` section.
+
+
+> **NOTE :** All of the above configurations are defined in the 

zeppelin git commit: [ZEPPELIN-1333] prevent calling runParagraph() on shift-enter event

2016-08-19 Thread corneadoug
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.6 d873afdfe -> c1bef


[ZEPPELIN-1333] prevent calling runParagraph() on shift-enter event

### What is this PR for?
when shift-enter is pressed in text box of dynamic form, the paragraph runs 
twice.
1) ng-enter event handler
2) global event handler

blocking shift-enter in ng-enter event handler, this issue could be resolved.

### What type of PR is it?
[Bug Fix]

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1333

### How should this be tested?
![image](https://cloud.githubusercontent.com/assets/6119284/17725846/af8775b4-6489-11e6-912f-99dbc8a050bb.png)
the test case above should return 1 with enter event and shift-enter event.

Author: Steven Han 

Closes #1336 from nazgul33/master and squashes the following commits:

54c5142 [Steven Han] [ZEPPELIN-1333] prevent calling runParagraph() on 
shift-enter event

(cherry picked from commit 371fa76cd558cf401322bc7fdd3fe266c3fd3741)
Signed-off-by: Damien CORNEAU 


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/c1be
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/c1be
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/c1be

Branch: refs/heads/branch-0.6
Commit: c1bef1ceac8c69397dce7c8ee6adc5cd5548
Parents: d873afd
Author: Steven Han 
Authored: Wed Aug 17 13:59:54 2016 +0900
Committer: Damien CORNEAU 
Committed: Fri Aug 19 18:04:31 2016 +0900

--
 zeppelin-web/src/components/ngenter/ngenter.directive.js | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/c1be/zeppelin-web/src/components/ngenter/ngenter.directive.js
--
diff --git a/zeppelin-web/src/components/ngenter/ngenter.directive.js 
b/zeppelin-web/src/components/ngenter/ngenter.directive.js
index f284c69..89826c9 100644
--- a/zeppelin-web/src/components/ngenter/ngenter.directive.js
+++ b/zeppelin-web/src/components/ngenter/ngenter.directive.js
@@ -17,9 +17,11 @@ angular.module('zeppelinWebApp').directive('ngEnter', 
function() {
   return function(scope, element, attrs) {
 element.bind('keydown keypress', function(event) {
   if (event.which === 13) {
-scope.$apply(function() {
-  scope.$eval(attrs.ngEnter);
-});
+if (!event.shiftKey) {
+  scope.$apply(function() {
+scope.$eval(attrs.ngEnter);
+  });
+}
 event.preventDefault();
   }
 });



zeppelin git commit: [ZEPPELIN-1333] prevent calling runParagraph() on shift-enter event

2016-08-19 Thread corneadoug
Repository: zeppelin
Updated Branches:
  refs/heads/master ff2465b9d -> 371fa76cd


[ZEPPELIN-1333] prevent calling runParagraph() on shift-enter event

### What is this PR for?
when shift-enter is pressed in text box of dynamic form, the paragraph runs 
twice.
1) ng-enter event handler
2) global event handler

blocking shift-enter in ng-enter event handler, this issue could be resolved.

### What type of PR is it?
[Bug Fix]

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1333

### How should this be tested?
![image](https://cloud.githubusercontent.com/assets/6119284/17725846/af8775b4-6489-11e6-912f-99dbc8a050bb.png)
the test case above should return 1 with enter event and shift-enter event.

Author: Steven Han 

Closes #1336 from nazgul33/master and squashes the following commits:

54c5142 [Steven Han] [ZEPPELIN-1333] prevent calling runParagraph() on 
shift-enter event


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/371fa76c
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/371fa76c
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/371fa76c

Branch: refs/heads/master
Commit: 371fa76cd558cf401322bc7fdd3fe266c3fd3741
Parents: ff2465b
Author: Steven Han 
Authored: Wed Aug 17 13:59:54 2016 +0900
Committer: Damien CORNEAU 
Committed: Fri Aug 19 18:03:08 2016 +0900

--
 zeppelin-web/src/components/ngenter/ngenter.directive.js | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/371fa76c/zeppelin-web/src/components/ngenter/ngenter.directive.js
--
diff --git a/zeppelin-web/src/components/ngenter/ngenter.directive.js 
b/zeppelin-web/src/components/ngenter/ngenter.directive.js
index f284c69..89826c9 100644
--- a/zeppelin-web/src/components/ngenter/ngenter.directive.js
+++ b/zeppelin-web/src/components/ngenter/ngenter.directive.js
@@ -17,9 +17,11 @@ angular.module('zeppelinWebApp').directive('ngEnter', 
function() {
   return function(scope, element, attrs) {
 element.bind('keydown keypress', function(event) {
   if (event.which === 13) {
-scope.$apply(function() {
-  scope.$eval(attrs.ngEnter);
-});
+if (!event.shiftKey) {
+  scope.$apply(function() {
+scope.$eval(attrs.ngEnter);
+  });
+}
 event.preventDefault();
   }
 });