def pre_add(self, db): self.check_extra(db) db.set_sqlalchemy_uri(db.sqlalchemy_uri) security_manager.add_permission_view_menu("database_access", db.perm) # adding a new database we always want to force refresh schema list for schema in db.get_all_schema_names(): security_manager.add_permission_view_menu( "schema_access", security_manager.get_schema_perm(db, schema))
def _pre_add_update(self, database): self.check_extra(database) self.check_encrypted_extra(database) database.set_sqlalchemy_uri(database.sqlalchemy_uri) security_manager.add_permission_view_menu("database_access", database.perm) # adding a new database we always want to force refresh schema list for schema in database.get_all_schema_names(): security_manager.add_permission_view_menu( "schema_access", security_manager.get_schema_perm(database, schema) )
def _pre_add_update(self, database: Database) -> None: if app.config["PREVENT_UNSAFE_DB_CONNECTIONS"]: check_sqlalchemy_uri(database.sqlalchemy_uri) self.check_extra(database) self.check_encrypted_extra(database) if database.server_cert: utils.parse_ssl_cert(database.server_cert) database.set_sqlalchemy_uri(database.sqlalchemy_uri) security_manager.add_permission_view_menu("database_access", database.perm) # adding a new database we always want to force refresh schema list for schema in database.get_all_schema_names(): security_manager.add_permission_view_menu( "schema_access", security_manager.get_schema_perm(database, schema) )
def schema_perm(self): """Returns schema permission if present, database one otherwise.""" return security_manager.get_schema_perm(self.database, self.schema)
def schema_perm(self): """Returns schema permission if present, cluster one otherwise.""" return security_manager.get_schema_perm(self.cluster, self.schema)