I'm working on an internal project and the tech team is requiring that the scheduled task be pointed to an actual file (index.php) and cannot access from localhost/controller/action. They are wanting
localhost/index.php?parm=&parm=
How can I do this?
Add your file in the webfoot folder. You should be able to access this in the browser.
You should not call "scheduled tasks" (cron jobs I assume) by an URL. You simply don't want to expose this kind of functionality to the public.
Write a shell for it and use command line args instead, this is the proper solution for that task and should be pretty easy to do if you followed the best practice "fat model, skinny controller" advice because you can simply reuse the logic there.
Related
We're designing a system for a client where they are allowing authenticated users to upload images. We've created an API to upload the files but the client only wants the latest file and delete all previous ones so that there would only ever be one.
We've looked through the docs and can't come across a way for ADAM to handle this in both 2SXC and DNN's file system.
Internally when deleting images we see API calls like the following to the internal 2SXC API, but we're wondering if this is exposed somewhere within the public API?
https://somedomain.com/api/2sxc/app/auto/data/61393528-b401-411f-a001-f423ea46700a/b7d04e2c-c565-496c-8efb-aa133cf90d33/Photo/delete?subfolder=&isFolder=false&id=189&usePortalRoot=false&appId=3
We could probably use the same endpoint above, but we'd likely run into permission issues or changes to the APIs that could be problematic.
Thank you for any advice you can give! Perhaps #iJungleBoy can provide some thoughts on this.
As a solution from a completely different direction, if you are on the later release of 2sxc (v12.8+, v13+), and comfortable programming in C#, you might consider doing this as a "cleanup" from a Dnn Scheduled Task. This can be done with a relatively easy setup. We have a Gist in place that we use as a starter. You simply put the code in the /App_Code folder then setup a normal Dnn Scheduled Task. NOTE that you can scroll down to the first comment on the Gist to see a screenshot of a complete working setup.
Accuraty's AccuTasks template on GitHub Gists
There are two more key things to note:
You need to install Dnn's CodeDom 3.6 because the example uses the later versions C#'s string interpolation - OR remove the few $"ASL2021 - {this.GetType().Name}, Task Scheduled Email", bits or convert to string.Format() or something.
Since your task's code is NOT running in a (2sxc) module, if needed, you'll do stuff like this: 2sxc Docs - Use 2sxc Instance or App Data from External C# Code
So, if you are comfortable writing code that "finds and deletes stuff older than NN days" - this might be the way to go.
I am using for the very first time salesforce as backend.
I need to add the same script to all the visualpages.
Is there a way to achieve this other than copy the same thing to all the visual pages?
A tool for importing the same script for instance.
Thanks
I'm not sure if I understand the question, but I presume you don't want to copy the whole script?
Somehow you still have to tell the VF page to use the script. I think the best practice would be to "pack" the script into a file (if this is JavaScript file the extension would be .js) and upload the file as a Static resource. You can then call the script on every VF page like so:
<apex:includeScript value="{!URLFOR($Resource.NAME_OF_YOUR_SCRIPT)}"></apex:includeScript>
Is that what you had in mind? :)
Cheers, G.
Since each part of MEAN stack projects are separated, it's really hard to refactor the whole project. I'm trying to do the following things
Modify mongoose schemas
Reorganize server code
Rename some api calls and parameters
Modify Angular code to adapt new APIs
Is there any good ways to do them?
There is no tool for any of theese dedicated to MEAN stack. Yeo Man got some generators but these existing are only for creating, not for refactoring. You can still create your own yeo man generator with custom actions or any other server side script that is looking for patterns and changing names according to given configuation file. This can be also automated with gulp or grunt task runners, but its really time-consuming ;)
Background
I have to migrte a existing javascript application (one page app) to extjs. The display and behavior of the application depends on the users permission.
Current design
The application is divided into plugins, which represent a feature set to which permissions are granted. Each of those plugins consists of a single javascript file. A user can have permissions for one or more plugins. Depending on the permissions, those files are loaded in the head of the page. Each of these plugins will add its entries to the main menu and expose the methods used to drive the application.
The permissions are stored in a mysql database.
ExtJs's default design
In ExtJs the source files contain each a class. During the build process, all .js files are concatenated to yield one big .js file, that contains everything.
What would be the best design approach?
I considered to use custom compilation with sencha cmd, and create that way a .js file for each plugin. Then I could load these plugins the same way I do it now. But this results in a complicated build and deployment process.
I also thought about creating one and only .js file with a standard Ext build process. I would then load the permissions from the server via ajax in order to construct the menu. All the objects and methods would exist, but only those are accessible where the user has permissions.
In my opinion, the second approach is much easier maintainable, but it seens to have a security problem, because everyone could look at the source and find out about the data interfaces exposed on the server and consumed by ajax.
Any comments, ideas or advices are welcome. Thanks !
Number two would be the way to go. If you keep your server side permissions in check (while updating data etc) you only need ExtJS to show/hide menu items based on permissions. That way, malicious users can turn certain plugins/items on or off, but they can never execute something that requires more permissions then they would normally have.
What's the best way to handle the scaffold when it comes to the deployment stage?
Leave it there? But then what's the best way to protect the access of it?
Remove it? But then I need another system to access all the data, right?
How do people usually handle the scaffold in CakePHP which is very useful in the building process?
Most people would not use scaffold anymore when getting close to deployment.
That is where "bake" comes into play.
You usually only scaffold while still changing the database structure heavily.
As soon as it gets stable you use custom bake templates to bake your views to real files.
I actually never use scaffolding as bake has way more advantages (such as full customization of the template output.
And rebaking is not that big of a deal. It is pretty fast to achieve.