Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
c8f3184f
Commit
c8f3184f
authored
Jan 23, 2017
by
kevalbhatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1489 : Show create/edit entity button based on role (Kalyanikashikar via kevalbhatt)
parent
7f914ab9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
62 additions
and
10 deletions
+62
-10
AtlasAuthorizationUtils.java
...pache/atlas/authorize/simple/AtlasAuthorizationUtils.java
+24
-1
main.js
dashboardv2/public/js/main.js
+6
-0
DetailPageLayoutView_tmpl.html
...c/js/templates/detail_page/DetailPageLayoutView_tmpl.html
+2
-1
SearchLayoutView_tmpl.html
...dv2/public/js/templates/search/SearchLayoutView_tmpl.html
+3
-1
DetailPageLayoutView.js
...ardv2/public/js/views/detail_page/DetailPageLayoutView.js
+2
-3
SearchLayoutView.js
dashboardv2/public/js/views/search/SearchLayoutView.js
+10
-2
SearchResultLayoutView.js
dashboardv2/public/js/views/search/SearchResultLayoutView.js
+1
-1
release-log.txt
release-log.txt
+1
-0
AdminResource.java
...in/java/org/apache/atlas/web/resources/AdminResource.java
+13
-1
No files found.
authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
View file @
c8f3184f
...
@@ -21,6 +21,10 @@ package org.apache.atlas.authorize.simple;
...
@@ -21,6 +21,10 @@ package org.apache.atlas.authorize.simple;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.authorize.AtlasActionTypes
;
import
org.apache.atlas.authorize.AtlasActionTypes
;
import
org.apache.atlas.authorize.AtlasResourceTypes
;
import
org.apache.atlas.authorize.AtlasResourceTypes
;
import
org.apache.atlas.authorize.AtlasAuthorizationException
;
import
org.apache.atlas.authorize.AtlasAuthorizer
;
import
org.apache.atlas.authorize.AtlasAccessRequest
;
import
org.apache.atlas.authorize.AtlasAuthorizerFactory
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -115,7 +119,7 @@ public class AtlasAuthorizationUtils {
...
@@ -115,7 +119,7 @@ public class AtlasAuthorizationUtils {
||
api
.
startsWith
(
"graph"
))
{
||
api
.
startsWith
(
"graph"
))
{
resourceTypes
.
add
(
AtlasResourceTypes
.
OPERATION
);
resourceTypes
.
add
(
AtlasResourceTypes
.
OPERATION
);
}
else
if
(
api
.
startsWith
(
"entities"
)
||
api
.
startsWith
(
"lineage"
)
||
}
else
if
(
api
.
startsWith
(
"entities"
)
||
api
.
startsWith
(
"lineage"
)
||
api
.
startsWith
(
"discovery"
)
||
api
.
startsWith
(
"entity"
))
{
api
.
startsWith
(
"discovery"
)
||
api
.
startsWith
(
"entity"
)
||
api
.
startsWith
(
"search"
)
)
{
resourceTypes
.
add
(
AtlasResourceTypes
.
ENTITY
);
resourceTypes
.
add
(
AtlasResourceTypes
.
ENTITY
);
}
else
if
(
api
.
startsWith
(
"taxonomies"
))
{
}
else
if
(
api
.
startsWith
(
"taxonomies"
))
{
resourceTypes
.
add
(
AtlasResourceTypes
.
TAXONOMY
);
resourceTypes
.
add
(
AtlasResourceTypes
.
TAXONOMY
);
...
@@ -135,4 +139,23 @@ public class AtlasAuthorizationUtils {
...
@@ -135,4 +139,23 @@ public class AtlasAuthorizationUtils {
}
}
return
resourceTypes
;
return
resourceTypes
;
}
}
public
static
boolean
isAccessAllowed
(
AtlasResourceTypes
resourcetype
,
AtlasActionTypes
actionType
,
String
userName
,
Set
<
String
>
groups
)
{
AtlasAuthorizer
authorizer
=
null
;
boolean
isaccessAllowed
=
false
;
Set
<
AtlasResourceTypes
>
resourceTypes
=
new
HashSet
<>();
resourceTypes
.
add
(
resourcetype
);
AtlasAccessRequest
atlasRequest
=
new
AtlasAccessRequest
(
resourceTypes
,
"*"
,
actionType
,
userName
,
groups
);
try
{
authorizer
=
AtlasAuthorizerFactory
.
getAtlasAuthorizer
();
if
(
authorizer
!=
null
)
{
isaccessAllowed
=
authorizer
.
isAccessAllowed
(
atlasRequest
);
}
}
catch
(
AtlasAuthorizationException
e
)
{
LOG
.
error
(
"Unable to obtain AtlasAuthorizer. "
,
e
);
}
return
isaccessAllowed
;
}
}
}
dashboardv2/public/js/main.js
View file @
c8f3184f
...
@@ -174,6 +174,12 @@ require(['App',
...
@@ -174,6 +174,12 @@ require(['App',
if
(
response
&&
response
[
'atlas.feature.taxonomy.enable'
]
!==
undefined
)
{
if
(
response
&&
response
[
'atlas.feature.taxonomy.enable'
]
!==
undefined
)
{
Globals
.
taxonomy
=
response
[
'atlas.feature.taxonomy.enable'
]
Globals
.
taxonomy
=
response
[
'atlas.feature.taxonomy.enable'
]
}
}
if
(
response
&&
response
[
'atlas.entity.create.allowed'
]
!==
undefined
)
{
Globals
.
entityCreate
=
response
[
'atlas.entity.create.allowed'
];
}
if
(
response
&&
response
[
'atlas.entity.update.allowed'
]
!==
undefined
)
{
Globals
.
entityUpdate
=
response
[
'atlas.entity.update.allowed'
];
}
App
.
start
();
App
.
start
();
}
}
});
});
...
...
dashboardv2/public/js/templates/detail_page/DetailPageLayoutView_tmpl.html
View file @
c8f3184f
...
@@ -22,8 +22,9 @@
...
@@ -22,8 +22,9 @@
<div
class=
"row"
>
<div
class=
"row"
>
<a
href=
"javascript:void(0);"
class=
"backButton"
data-id=
"backButton"
><i
class=
"fa fa-chevron-left"
></i>
Back To Results
</a>
<a
href=
"javascript:void(0);"
class=
"backButton"
data-id=
"backButton"
><i
class=
"fa fa-chevron-left"
></i>
Back To Results
</a>
</div>
</div>
<h1><span
data-id=
"title"
></span></h1>
<h1><span
data-id=
"title"
></span></h1>
{{#if entityUpdate}}
<button
data-id=
"editButton"
class=
"btn btn-default pull-right editbutton"
id=
"editText"
><i
class=
"fa fa-pencil"
></i></button>
<button
data-id=
"editButton"
class=
"btn btn-default pull-right editbutton"
id=
"editText"
><i
class=
"fa fa-pencil"
></i></button>
{{/if}}
<div
class=
"tagTerm"
>
<div
class=
"tagTerm"
>
<span
class=
"tagSpan"
>
Tags:
</span>
<span
class=
"tagSpan"
>
Tags:
</span>
<div
class=
""
data-id=
"tagList"
>
<div
class=
""
data-id=
"tagList"
>
...
...
dashboardv2/public/js/templates/search/SearchLayoutView_tmpl.html
View file @
c8f3184f
...
@@ -15,15 +15,17 @@
...
@@ -15,15 +15,17 @@
* limitations under the License.
* limitations under the License.
-->
-->
<div
class=
"row row-margin-bottom"
>
<div
class=
"row row-margin-bottom"
>
{{#if entityCreate}}
<div
class=
"col-sm-12"
>
<div
class=
"col-sm-12"
>
<button
class=
"btn btn-atlasAction btn-atlas pull-left"
data-id=
"createEntity"
><i
class=
"fa fa-plus"
></i>
Create Entity
</button>
<button
class=
"btn btn-atlasAction btn-atlas pull-left"
data-id=
"createEntity"
><i
class=
"fa fa-plus"
></i>
Create Entity
</button>
</div>
</div>
{{/if}}
<div
class=
"col-sm-12"
style=
"margin:15px 0px;"
>
<div
class=
"col-sm-12"
style=
"margin:15px 0px;"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<div
class=
"col-md-6"
>
<span
class=
"pull-left"
>
Text
</span>
<span
class=
"pull-left"
>
Text
</span>
<label
class=
"switch pull-left"
>
<label
class=
"switch pull-left"
>
<input
type=
"checkbox"
class=
"switch-input"
name=
"queryType"
value=
"text"
/>
<input
type=
"checkbox"
class=
"switch-input"
name=
"queryType"
value=
"text"
/>
<span
class=
"switch-slider"
></span>
<span
class=
"switch-slider"
></span>
</label>
</label>
<span
class=
"pull-left"
>
DSL
</span>
<span
class=
"pull-left"
>
DSL
</span>
...
...
dashboardv2/public/js/views/detail_page/DetailPageLayoutView.js
View file @
c8f3184f
...
@@ -61,15 +61,14 @@ define(['require',
...
@@ -61,15 +61,14 @@ define(['require',
},
},
templateHelpers
:
function
()
{
templateHelpers
:
function
()
{
return
{
return
{
taxonomy
:
Globals
.
taxonomy
taxonomy
:
Globals
.
taxonomy
,
entityUpdate
:
Globals
.
entityUpdate
};
};
},
},
/** ui events hash */
/** ui events hash */
events
:
function
()
{
events
:
function
()
{
var
events
=
{};
var
events
=
{};
if
(
Globals
.
entityCrud
)
{
events
[
"click "
+
this
.
ui
.
editButton
]
=
'onClickEditEntity'
;
events
[
"click "
+
this
.
ui
.
editButton
]
=
'onClickEditEntity'
;
}
events
[
"click "
+
this
.
ui
.
tagClick
]
=
function
(
e
)
{
events
[
"click "
+
this
.
ui
.
tagClick
]
=
function
(
e
)
{
if
(
e
.
target
.
nodeName
.
toLocaleLowerCase
()
!=
"i"
)
{
if
(
e
.
target
.
nodeName
.
toLocaleLowerCase
()
!=
"i"
)
{
var
scope
=
$
(
e
.
currentTarget
);
var
scope
=
$
(
e
.
currentTarget
);
...
...
dashboardv2/public/js/views/search/SearchLayoutView.js
View file @
c8f3184f
...
@@ -21,8 +21,9 @@ define(['require',
...
@@ -21,8 +21,9 @@ define(['require',
'hbs!tmpl/search/SearchLayoutView_tmpl'
,
'hbs!tmpl/search/SearchLayoutView_tmpl'
,
'collection/VTagList'
,
'collection/VTagList'
,
'utils/Utils'
,
'utils/Utils'
,
'utils/UrlLinks'
'utils/UrlLinks'
,
],
function
(
require
,
Backbone
,
SearchLayoutViewTmpl
,
VTagList
,
Utils
,
UrlLinks
)
{
'utils/Globals'
,
],
function
(
require
,
Backbone
,
SearchLayoutViewTmpl
,
VTagList
,
Utils
,
UrlLinks
,
Globals
)
{
'use strict'
;
'use strict'
;
var
SearchLayoutView
=
Backbone
.
Marionette
.
LayoutView
.
extend
(
var
SearchLayoutView
=
Backbone
.
Marionette
.
LayoutView
.
extend
(
...
@@ -45,6 +46,13 @@ define(['require',
...
@@ -45,6 +46,13 @@ define(['require',
refreshBtn
:
'[data-id="refreshBtn"]'
,
refreshBtn
:
'[data-id="refreshBtn"]'
,
createEntity
:
"[data-id='createEntity']"
,
createEntity
:
"[data-id='createEntity']"
,
},
},
templateHelpers
:
function
()
{
return
{
entityCreate
:
Globals
.
entityCreate
};
},
/** ui events hash */
/** ui events hash */
events
:
function
()
{
events
:
function
()
{
var
events
=
{},
var
events
=
{},
...
...
dashboardv2/public/js/views/search/SearchResultLayoutView.js
View file @
c8f3184f
...
@@ -449,7 +449,7 @@ define(['require',
...
@@ -449,7 +449,7 @@ define(['require',
nameHtml
+=
'<button type="button" title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>'
;
nameHtml
+=
'<button type="button" title="Deleted" class="btn btn-atlasAction btn-atlas deleteBtn"><i class="fa fa-trash"></i></button>'
;
return
'<div class="readOnly readOnlyLink">'
+
nameHtml
+
'</div>'
;
return
'<div class="readOnly readOnlyLink">'
+
nameHtml
+
'</div>'
;
}
else
{
}
else
{
if
(
Globals
.
entity
Crud
)
{
if
(
Globals
.
entity
Update
)
{
nameHtml
+=
'<button title="Edit" data-id="editEntityButton" data-giud= "'
+
(
model
.
get
(
'$id$'
).
id
||
model
.
get
(
'$id$'
))
+
'" class="btn btn-atlasAction btn-atlas editBtn"><i class="fa fa-pencil"></i></button>'
nameHtml
+=
'<button title="Edit" data-id="editEntityButton" data-giud= "'
+
(
model
.
get
(
'$id$'
).
id
||
model
.
get
(
'$id$'
))
+
'" class="btn btn-atlasAction btn-atlas editBtn"><i class="fa fa-pencil"></i></button>'
}
}
return
nameHtml
;
return
nameHtml
;
...
...
release-log.txt
View file @
c8f3184f
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ALL CHANGES:
ATLAS-1489 Show create/edit entity button based on role (Kalyanikashikar via kevalbhatt)
ATLAS-1478 REST API to add classification to multiple entities (svimal2106 via mneethiraj)
ATLAS-1478 REST API to add classification to multiple entities (svimal2106 via mneethiraj)
ATLAS-1490 added methods to get sub-types of entity and classification types (mneethiraj)
ATLAS-1490 added methods to get sub-types of entity and classification types (mneethiraj)
ATLAS-1437 UI update to disallow tag association changes to deleted entities (Kalyanikashikar via mneethiraj)
ATLAS-1437 UI update to disallow tag association changes to deleted entities (Kalyanikashikar via mneethiraj)
...
...
webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
View file @
c8f3184f
...
@@ -20,6 +20,9 @@ package org.apache.atlas.web.resources;
...
@@ -20,6 +20,9 @@ package org.apache.atlas.web.resources;
import
com.google.inject.Inject
;
import
com.google.inject.Inject
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.authorize.AtlasActionTypes
;
import
org.apache.atlas.authorize.AtlasResourceTypes
;
import
org.apache.atlas.authorize.simple.AtlasAuthorizationUtils
;
import
org.apache.atlas.web.filters.AtlasCSRFPreventionFilter
;
import
org.apache.atlas.web.filters.AtlasCSRFPreventionFilter
;
import
org.apache.atlas.web.service.ServiceState
;
import
org.apache.atlas.web.service.ServiceState
;
import
org.apache.atlas.web.util.Servlets
;
import
org.apache.atlas.web.util.Servlets
;
...
@@ -58,7 +61,8 @@ public class AdminResource {
...
@@ -58,7 +61,8 @@ public class AdminResource {
private
static
final
String
CUSTOM_METHODS_TO_IGNORE_PARAM
=
"atlas.rest-csrf.methods-to-ignore"
;
private
static
final
String
CUSTOM_METHODS_TO_IGNORE_PARAM
=
"atlas.rest-csrf.methods-to-ignore"
;
private
static
final
String
CUSTOM_HEADER_PARAM
=
"atlas.rest-csrf.custom-header"
;
private
static
final
String
CUSTOM_HEADER_PARAM
=
"atlas.rest-csrf.custom-header"
;
private
static
final
String
isTaxonomyEnabled
=
"atlas.feature.taxonomy.enable"
;
private
static
final
String
isTaxonomyEnabled
=
"atlas.feature.taxonomy.enable"
;
private
static
final
String
isEntityUpdateAllowed
=
"atlas.entity.update.allowed"
;
private
static
final
String
isEntityCreateAllowed
=
"atlas.entity.create.allowed"
;
private
Response
version
;
private
Response
version
;
private
ServiceState
serviceState
;
private
ServiceState
serviceState
;
...
@@ -179,6 +183,8 @@ public class AdminResource {
...
@@ -179,6 +183,8 @@ public class AdminResource {
try
{
try
{
PropertiesConfiguration
configProperties
=
new
PropertiesConfiguration
(
"atlas-application.properties"
);
PropertiesConfiguration
configProperties
=
new
PropertiesConfiguration
(
"atlas-application.properties"
);
Boolean
enableTaxonomy
=
configProperties
.
getBoolean
(
isTaxonomyEnabled
,
false
);
Boolean
enableTaxonomy
=
configProperties
.
getBoolean
(
isTaxonomyEnabled
,
false
);
boolean
isEntityUpdateAccessAllowed
=
false
;
boolean
isEntityCreateAccessAllowed
=
false
;
Authentication
auth
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
Authentication
auth
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
String
userName
=
null
;
String
userName
=
null
;
Set
<
String
>
groups
=
new
HashSet
<>();
Set
<
String
>
groups
=
new
HashSet
<>();
...
@@ -188,6 +194,10 @@ public class AdminResource {
...
@@ -188,6 +194,10 @@ public class AdminResource {
for
(
GrantedAuthority
c
:
authorities
)
{
for
(
GrantedAuthority
c
:
authorities
)
{
groups
.
add
(
c
.
getAuthority
());
groups
.
add
(
c
.
getAuthority
());
}
}
isEntityUpdateAccessAllowed
=
AtlasAuthorizationUtils
.
isAccessAllowed
(
AtlasResourceTypes
.
ENTITY
,
AtlasActionTypes
.
UPDATE
,
userName
,
groups
);
isEntityCreateAccessAllowed
=
AtlasAuthorizationUtils
.
isAccessAllowed
(
AtlasResourceTypes
.
ENTITY
,
AtlasActionTypes
.
CREATE
,
userName
,
groups
);
}
}
JSONObject
responseData
=
new
JSONObject
();
JSONObject
responseData
=
new
JSONObject
();
...
@@ -197,6 +207,8 @@ public class AdminResource {
...
@@ -197,6 +207,8 @@ public class AdminResource {
responseData
.
put
(
CUSTOM_METHODS_TO_IGNORE_PARAM
,
AtlasCSRFPreventionFilter
.
METHODS_TO_IGNORE_DEFAULT
);
responseData
.
put
(
CUSTOM_METHODS_TO_IGNORE_PARAM
,
AtlasCSRFPreventionFilter
.
METHODS_TO_IGNORE_DEFAULT
);
responseData
.
put
(
CUSTOM_HEADER_PARAM
,
AtlasCSRFPreventionFilter
.
HEADER_DEFAULT
);
responseData
.
put
(
CUSTOM_HEADER_PARAM
,
AtlasCSRFPreventionFilter
.
HEADER_DEFAULT
);
responseData
.
put
(
isTaxonomyEnabled
,
enableTaxonomy
);
responseData
.
put
(
isTaxonomyEnabled
,
enableTaxonomy
);
responseData
.
put
(
isEntityUpdateAllowed
,
isEntityUpdateAccessAllowed
);
responseData
.
put
(
isEntityCreateAllowed
,
isEntityCreateAccessAllowed
);
responseData
.
put
(
"userName"
,
userName
);
responseData
.
put
(
"userName"
,
userName
);
responseData
.
put
(
"groups"
,
groups
);
responseData
.
put
(
"groups"
,
groups
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment