mirror of
https://github.com/getredash/redash.git
synced 2025-12-25 01:03:20 -05:00
add backend API and tests for managing access permissions.
This commit is contained in:
committed by
Arik Fraimovich
parent
2a688200be
commit
903ba0c1e0
@@ -82,6 +82,13 @@ query_with_params_factory = ModelFactory(redash.models.Query,
|
||||
data_source=data_source_factory.create,
|
||||
org=1)
|
||||
|
||||
access_permission_factory = ModelFactory(redash.models.AccessPermission,
|
||||
object_id=query_factory.create,
|
||||
object_type=redash.models.Query.__name__,
|
||||
access_type=redash.models.AccessPermission.ACCESS_TYPE_MODIFY,
|
||||
grantor=user_factory.create,
|
||||
grantee=user_factory.create)
|
||||
|
||||
alert_factory = ModelFactory(redash.models.Alert,
|
||||
name=Sequence('Alert {}'),
|
||||
query=query_factory.create,
|
||||
@@ -240,6 +247,13 @@ class Factory(object):
|
||||
args.update(kwargs)
|
||||
return query_with_params_factory.create(**args)
|
||||
|
||||
def create_access_permission(self, **kwargs):
|
||||
args = {
|
||||
'grantor': self.user
|
||||
}
|
||||
args.update(kwargs)
|
||||
return access_permission_factory.create(**args)
|
||||
|
||||
def create_query_result(self, **kwargs):
|
||||
args = {
|
||||
'data_source': self.data_source,
|
||||
|
||||
Reference in New Issue
Block a user