I am developing an application page in sharepoint 2010, in this page the users gets a list of available training courses, and there is a link to register to it.
The problem is that the common users does not have access to the list where the attendances are register, so if I run the application with an user with priviledges it works, but if I try to run it with a common user it fails.
What can i do?
Thanks for any advice ..!
Your code block must run by the following code:
SPSecurity.RunWithElevatedPrivileges(delegate() {
// write to list code ...
}
Related
I'm not very used to Apostrophe and currently checking out that CMS.
What I want to do is implementing a user login at the frontend.
I tried using the apostrophe-user module but users that were created using that module are able to login to the backend and I don't want them to be able to do this.
Is it somehow possible to achieve what I want to do?
Thank you very much in advance!
Edit: I'm also using apostrophe-headless
You can use apostrophe-groups to create a sub group of users with specific permissions and then check those permissions in various places (like templates) to show or not show certain admin experiences.
https://apostrophecms.org/docs/tutorials/intermediate/permissions.html
You could further customize the login experience of these users by tapping in to the apostrophe-login, redirecting them to a special part of the website, etc https://apostrophecms.org/docs/modules/apostrophe-login/index.html
I'm new to Piranha CMS and just trying to get my head around it. I'm using the MVC implementation and I need to do the following:
I need to extend the User with a property that stores an account number.
I need a page that is only accessible once the user logs in
On this page, I need to call a REST API on another server, using the account number a parameter, to retrieve a list of documents that the user has stored on this server.
When the user clicks the document, it will be downloaded as a PDF using the REST API once again
I just need general guidance on how to do this. How do I store the account number against the user (and manage this) and do I need to create a new Region that will show the list of documents from the remote server. Is there an example of creating a new Region anywhere and maybe returning a list from SQL that I can adapt?
Any help gratefully received.
Thanks in advance
Mike
The easiest way is to implement an extension with your custom fields that you attach to the user where you store this information.
When editing a page, go in under "settings" and select which groups should have access to your page. For this purpose I suggest creating a new group for site users that are not admins.
This should be easily implemented in either the controller or model for your page. When the user is logged in "User.Identity.Name" is the user id. Get the user, load the extensions & use the account number.
See number three.
Regards
I have a Google Apps Script that executes as me.
In the script, I want to know the user's email.
So I refer to the email of the user accessing my application as Session.getActiveUser().getEmail()
That's not working out at all. Google Apps Script is giving an error, saying
Session.getActiveUser().getEmail() is NULL.
When I manually enter a dummy email instead of Session.getActiveUser().getEmail(), the code works perfectly
PS: The app MUST execute as me, because it needs to access my contacts.
You cannot have Session.getActiveUser().getEmail() return the user's email id while the app is running as you. There are some workarounds you can try
Ask for the user's email id explicitly.
Write two scripts - one which is the front end UI etc. that run as the user accessing the app (this allows Session.getActiveUser().getEmail() to return the user's email address). Have a second script that does the tasks where your contacts are accessed.
Call the second script from the first by using doPost and doGet methods in your second script.
For example,
Script 1:
function whatever(){
UrlFetchApp.fetch('SERVICE_URL_OF_SCRIPT_2');
}
Script 2:
function doGet(e){
// code to access your contact, get parameters in e.parameters
}
I need a way to identify users. I have a Google site that is users access via their gmail accounts. My site is designed to allow users to view any data, but edit only their own data. This works fine for me as I'm the owner of the site and publisher of the scripts, but Session.getActiveUser().getUserLoginId() returns null for anyone else.
Please provide me the solution about this problem. Any link / any piece of code?
I suppose, that the script is deployed with the Execute the app as: combobox set to me. Please check it and change the combobox value to User accessing the web app.
We're working on a publishing site with sharepoint 2010. It allows anonymous access, and these anonymous users can fill out certain forms. The form submission works fine as the anonymous user has permission to insert to the lists.
There is a simple workflow attached to each form that emails the contents of the form to an internal user. This works fine if you add the list item manually (ie logged in as a certain user), but the workflow can't be initiated by an anonymous user. It hangs in progress, then eventually fails.
I tried this:
http://blog.furuknap.net/enabling-declarative-workflows-for-anonymous-users-in-sp20102007
But it didn't seem to work either. Some comments from users refer to this same issue - and no one stated a resolution.
I'm worried that the only solution is the run with elevated privileges on each form as a custom web part.
Any solutions out there?
thanks.
The steps described in the mentioned post only work for items added to the list by email. So any items added (new form, new document, new event) added using the sharepoint UI will NOT trigger the workflows. (see the related MS KB article).
There are 2 things I can think of you could try:
Use an ItemEventReceiver bound to the list to send the email in the ItemAdded event.
If all the workflow does is send an email to a user, just have that user subscribe to the list using an alert