Moodle custom service creation issue - moodle

I am trying to create Moodle custom service for my functionality enhancement
1 ) https://docs.moodle.org/dev/External_functions_API
2 ) https://docs.moodle.org/dev/Adding_a_web_service_to_a_plugin
updated service module based on these documents.created service module and external_lib.php file.
But i got error while accessing the web service API
Error :
{"exception":"dml_missing_record_exception","errorcode":"invalidrecord","message"
:"Can not find data record in database table external_functions."}
Enabled debug mode and tried again . It shows external function registration error .
{"exception":"dml_missing_record_exception","errorcode":"invalidrecord","mess age"
:"Can not find data record in database table external_functions.","debuginfo":"SELECT * FROM {external_functions
} WHERE name = ?\n[array (\n 0 => 'local_enroll_course',\n)]"}
How can i register newly created service inside Moodle ? Pls Help

You need to increment your version number in version.php and go to Notifications in Moodle and run an upgrade. Then Moodle will recognise the new function that you have added into externallib.php and db/services.php

Related

ASP.NET Core Rest API Saving Failed saying no access to another database

My ASP.NET Core Rest API is returning a 500 Internal Server Error on post method while adding a new customer. I am able to get data from my development database, but myDbContext.SaveChanges(); failed saying my development user doesn't have access to the main database, but my connection string refers to my development database only.
My database name : MyappDbDev
My database user : AppUserDev
Error:
The server principal "AppUserDev" is not able to access the database "MyappDbDev" under the current security context
I have another database in production with following credentials:
Database name : MyappDb
Database user : AppUser
I didn't find any useful suggestions after researching for days, at last I found that I had a trigger for the table that I am adding new record.
which the trigger had insert command to old database.
It was a silly mistake , but I hope this may help someone someday.

Cannot delete old MariaDB 5.5.4 End-of Life on 31.01

Migrated successfully to new MariaDB Service. Kept the old just in case.
Now I am not able to delete the old service via Web Console.
Message: Delete App bindings and Service keys first.
But: There are no app bindings and service keys cannot be deleted due to 'internal server error'.
So what's to do?
I am confident you already solved this, but just in case. You will have to reach out to the Swisscom Support System and send them a message at the bottom of this page: https://developer.swisscom.com/support
They will be able to delete the service instance for you.
PS: don't forget to include your Organization / Space / Service Name in that correspondence (not here)

AWS MobileAnalyticsManager access to folder 'AWS Mobile Services\M4SP' is denied

I am trying to add the AWSSDK DLL into my C# code to collect my event data and pass the data to the AWS bucket. My C# code is created with VS Share point template. The project contains WSP files. The following code indicates how I use the AWSSDK :
using Amazon;
using Amazon.CognitoIdentity;
using Amazon.MobileAnalytics.MobileAnalyticsManager;
CognitoAWSCredentials credentials = new CognitoAWSCredentials(
"us-east-1:xxxxxx",//PoolID
RegionEndpoint.USEast1
);
Amazon.AWSConfigs.ApplicationName = "M4SP";
AWSConfigs.LoggingConfig.LogMetrics = true;
AWSConfigs.LoggingConfig.LogResponses = ResponseLoggingOption.Always;
AWSConfigs.LoggingConfig.LogMetricsFormat = LogMetricsFormatOption.JSON;
MobileAnalyticsManager manager = MobileAnalyticsManager.GetOrCreateInstance(
"xxxxxxxxxxxxxxxxxxx",//AppID
credentials,
RegionEndpoint.USEast1 // Region
);
CustomEvent customEvent = new CustomEvent("TestRecordEvent");
customEvent.AddAttribute("label", "M4SP");
customEvent.AddAttribute("action", "invoke");
customEvent.AddAttribute("details", "run the workflow test");
manager.RecordEvent(customEvent);
I found the code inside AWSSDK DLL was trying to log the data to local folder before passing it to AWS database. The location of the folder is C:\Users\[userid]\AppData\Roaming\AWS Mobile Services.
There is no problem in a standalone project since it always uses current user’s identity to run the application so it has access to the folder. But, because of the authentication mechanism of SharePoint solutions, it uses Application Pool Identity to access the folder and it gets access denied issue and the whole process fails.
Here is the error:
"Access to the path 'AWS Mobile Services\M4SP' is denied."
I modified the access right of Share point Application Pool Identity (in my case, it is “network service” account) but it still can’t access the folder .
Does anyone have a solution for this issue? Thanks very much for the help!!

Bluemix SAML and timeout session issue

I've created Web Application running on Java Liberty Runtime on Bluemix. Login is done by using SSO service with SAML enterprise provider. After login user redirected to my app and on every JAX-RS request I get user's credentials by following code:
Subject s = WSSubject.getCallerSubject();
Object credential = s.getPrivateCredentials().iterator().next();
String loginToken = credential.toString();
Everything works fine, but if the user has been idle for more then 10 minutes and then perform any ajax request WSSubject.getCallerSubject() returns null, and I required to refresh application.
I've tried to increase timeout by adding following attribute to web.xml:
<session-config>
<session-timeout>60</session-timeout>
</session-config>
But it didn't help. So I'm looking how can I increase timeout or possible I can retrieve user credentials in a different way?
You need to add the optional element <authCache> to the server.xml file to change the default values for the authentication cache.
As you mentioned in your question, the default value is 10 minutes. To change it to 60 minutes you need to include the following in the server.xml file:
<authCache initialSize="50" maxSize="25000" timeout="60m"/>
The documentation here provides more details and also explains initialSize and maxSize options, I left the default value for these two above and just updated timeout.
If you are deploying your application using the default method of pushing the war file, you will need to use a different approach to deploy the application with a custom server.xml file. Please check the documentation here for options on pushing Liberty profile applications (more specific check sections Server Directory and Packaged Server).
In this case, you may also want to check the server.xml file that is currently deployed and modify that version to add the <authCache> element.
You can get a copy of the file by running the following command:
$ cf files <your_app_name> app/wlp/usr/servers/defaultServer/server.xml

Using SQL Server CE 4.0 with Entity Framework on Windows Azure

I am using SQL Server CE 4.0 with WebApi on Windows Azure Websites. I have been successfully able to deploy SQL Server CE. The weird problem I am facing is that my site is able to log me in using the same DB but I am not able to use any of the controllers to fetch the data.
I am using same connection string for both. The only difference is that for logging in I am using WebSecurity as I have enabled OAuth on the site.
Can someone throw some light on how to debug and fix this issue? The error I am getting for the calls is
Format of the initialization string does not conform to specification
starting at index 0.
However the same string works for authentication, change password, adding OAuth connections etc.
Thanks in advance
I connected to the site using FTP. I was not giving the site name as domain name and it was denying me access earlier. On connecting, I got hold of the Web.config file and I found something interesting. While publishing the site, the web.config was modified to add another connectionstring with the name of context_DatabasePublish.
This string had following details connectionString="ContextName_DatabasePublish.ConnetionString" providerName="System.Data.SqlClient"
Also there was a new section called context added to the entityframework section of the config file with all the details for the context to use but again pointing to same connection string. The provider it is using is sql and not sqlce. I believe that is the reason it was failing.
I uploaded my normal config file and the site started working. I need to explore more on to why and how the new connection string got added. I will post the details in comments.