I am trying to develop a role manager app in SPEAK where users can view the list of available roles and add/modify roles.
I know that we can get the list of current roles by using the API like this ,
Sitecore.Security.Accounts.RolesInRolesManager.GetUsersInRole(Role.FromName("Content Authors"), true);
How do I achieve this in SPEAK ? As there is no controller where I get the model properties and return it to view, how do I get to bind this list to the list page in SPEAK ? Or is there a better way of doing this?
Have a look at my following example SPEAK examples.
Here is a SPEAK list control with custom data binding. You can use this to display your data in the list you mention.
http://mikerobbins.co.uk/2015/03/30/sitecore-speak-list-component-custom-tile-and-knockout-databinding/
As for exposing the data you require, EntityService allows you to implement custom code and expose any data you wish from your custom controller. There is a JavaScript API allowing you to access the JSON data directly in your SPEAK PageCode.
http://mikerobbins.co.uk/2015/01/06/entityservice-sitecore-service-client/
I have also created some videos on this subject.
SPEAK List Control and Databinding: https://www.youtube.com/watch?v=ZKld8i7qX1A
Entity Service: https://www.youtube.com/watch?v=g0cVr6CnNKM
Related
I had to create additional table in tenant user store to store some specific data. Now I need to fetch data from this table during authentication in authenticator. What possibilities do I have to make a sql query to this new table? I know I can create custom user store manager, but it looks like overengineering to me.
There are two ways that you can do this.
Write a custom authenticator
Write a custom user store manager
The above depends on the logic that you want to implement.
== Write a custom authenticator ==
Let's say you need to use these for username and password authentication. Then you can implement a custom authenticator by extending the existing authenticator. You can refer to this blog for more details.
== Writing a custom user store manager ==
You can easily extend the existing user store manager and overwrite the auth-related methods to suit your need. You will be able to find many documentation and medium articles related to this. I would like to recommend this approach since this is related to the user stores.
Also, you can see whether you can achieve this using the Pre-Post listeners (If possible then this would be the easiest approach). During the user store manager auth methods, UMs fire pre-authentication and post-authentication methods. If you add a new listener and subscribe that to any of those events you might be able to achieve this use case.
I want use another dashboard project based on Javascript to show data ,but I don`t know how to get the Statistical data. Is there any api or some way to get the data?
It would be better if you can share what kind of data do you want to portrait in your dashboard. Anyhow you can use the admin services available in ESB 6.5 to get the available data.
https://docs.wso2.com/display/EI650/Working+with+Admin+Services
Ι am aware of the fact that I can use permission levels to hide a certain list from others. At the same time, I would like to use the javascript api to write to the same list. That it, I would like to use the list as an internal data keeping list not visible to all but accessible to everyone (through the api).
Is this possible? I am asking because if you set permission levels on who gets to see the list, don't they (the permissions) affect what you can do with the api?
Thank you
Yes, the JavaScript APIs are limited in what they can do based on the permission of the user running the script.
You can use the JSOM API to make a hidden list, which will not be visible on the site contents page, but to which end users can still have access. This is similar to how the SharePoint 2010 Workflow History List is hidden. Use the JSOM API to set a list's Hidden property to be true, or when you create the list, set its custom schema XML so that the Hidden attribute of the List element is set to true; see here for a list schema XML reference.
I have two different objects in my API, we can call them users as tasks. I want to shape the API so users can only access tasks associated with them, but admin can access all tasks. How would I check to make sure what they are requesting matches their username? I have login working as per http://code.tutsplus.com/tutorials/building-rest-apis-using-eve--cms-22961 but I'd like to be able to create a more encompassing API.
You might resort to User Restricted Resource Access
When this feature is enabled, each stored document is associated with the account that created it. This allows the API to transparently serve only account-created documents on all kinds of requests: read, edit, delete and of course create. User authentication needs to be enabled for this to work properly.
See the relevant documentation at the link above.
Is it possible to get a list of alerts for ALL users within a given site? After messing with the GetAlerts method in /_vti_bin/Lists.asmx, it seems it always executes in the context of the user who provided it with credentials, and will only return the Alerts for THAT user. I was hoping to get a list of EVERY alert within the site.
I know I can probably do this via the SharePoint API in a console app but was hoping to use web services or another method that didn't require direct access to the SharePoint box.
I guess the other method would be to write a custom web service... but I was hoping for something quick and easy.
I think you have answered your question. There is no easy way, only custom coding is left.
Couldn't you use the _vti_bin/sitedata.asmx GetListItems (it allows you to send CAML) method to retrieve alerts and just run the call to the service as the application pool's identity, that should retrieve all items, since the application pool identity is the system account for your site collection....