gkhn.topcu - Monday, January 23, 2012 4:08 AM:
Hi all ,
I designed a dashboard screen and i get all information using "ApplySql()" command. But user get error like that;
I know it's about db permissions,And i try to add PublicUser to Security-->Logins etc..But cant solve problem..Is there any solution ?
Thanks,
Topcu
vishal_trivedi - Friday, January 27, 2012 1:01 AM:
Hi,
Can you describe this little bit more??
So, that I can understand your problem.
Regards,
Vishal
mendenaresh1357 - Friday, January 27, 2012 7:19 AM:
HI,
I think the applySQL can be used only by privileged Users. Add the Identity to the 'Administrators' Group. This might solve your Issue.
Also you can give temporary admin privileges to the identity by using the following code
// Code to Escalate to Administrators
Aras.Server.Security.Identity assignedIdent = Aras.Server.Security.Identity.GetByName("Administrators");
bool PermissionWasSet = Aras.Server.Security.Permissions.GrantIdentity(assignedIdent);
************Do your ApplySQL here**********
//Revoke the permissions
if (PermissionWasSet) Aras.Server.Security.Permissions.RevokeIdentity(assignedIdent);
// End of Code to Escalate Users to Administrators
Regards,
Naresh Mende
gkhn.topcu - Tuesday, January 31, 2012 4:58 AM:
I use applySQL("select * from ***") to get information about user's dashboard.It's a simple html page that i used only js and import it as a frame in aras.But Users get error about Previliged and applySQL (i send error's screeenshot at top).
Thanx for reply Naresh i can't add the Identity to the 'Administrators' Group because it has some settings screen that user can't saw.
Your solution is logical but when i try to give them temporary admin priviliged user still get same error?..Is there any settings that i can permission to normal user for ApplySQL command?
srry for my bad english:)
Thanks;
Topcu
Eric Domke - Monday, March 5, 2012 1:03 PM:
If you are doing the ApplySQL in a server method, then another approach is the following (written in VB.Net):
Dim params As New Xml.XmlDocument Dim result As New Xml.XmlDocument result.LoadXml("<Item/>") params.LoadXml("<sql>" & YOUR_SQL_QUERY_HERE & "</sql>") CCO.ApplyItem.ApplySQL(params, result) Dim props As Item = inn.newItem() props.loadAML(result.OuterXml)
This is equivalent to using the IOM ApplySQL command but should bypass any security checks.
asha_gholve - Wednesday, April 4, 2012 3:24 AM:
Hi Eric,
I am facing the same error but my method is client side method. what would be the solution for it???
thanks
Asha
Eric Domke - Wednesday, April 4, 2012 8:41 AM:
The only solution I am aware of is to write a server method that executes the ApplySQL portion of your code. This method would use either the escalation code Naresh proposed or the direct call code that I proposed to bypass the security restrictions. Then, have your client method call the custom server method that you created.
vasant - Saturday, April 7, 2012 12:46 AM:
Hi ALL,
As the applySQL can be used only by privileged Users i.e, 'Administrators' Group.
So to run applySQL() method in javascript(Client side code) we should have Administrator credentials.
So to run it we temporary creates connection with Admin login, run the method and close the connection.
It can be done as:
var login_name="admin";
var password = "innovator";
var database=top.aras.getDatabase();
var url=document.URL;
url = url.substring(0,url.length-30);
var httpServerConnection = IomFactory.CreateHttpServerConnection(url,database, login_name,password);
var loginResult = httpServerConnection.login();
try
{
var innovator = IomFactory.CreateInnovator(httpServerConnection);
var Result=innovator.applySQL("select keyed_name,id from innovator.[Part]");
}
finally
{
httpServerConnection.logout();
}
alert(Result.getItemByIndex(0).getProperty("keyed_name"));
return this;
Hope it Helps...
Thanks & Regards,
Vasant Padhiyar