ApplySQL Previleges Issue

Hello All,

I have a method that uses ApplySQL which works just fine for the user that have administrative privileges. However, for non-admin users the method does not work and error out. Learned that this is because of the function ApplySQL, so trying to find alternatives for this function call which could be ApplyAML().

Need some help changing the below sql query that is being passed to ApplySQL to convert into AML so it can be passed to ApplyAML.

ApplySQL():


  1) var sql = "select a from [b] where c = '{d}'";
  2) var res = document.thisItem.getInnovator().applySQL(sql.replace("{d}", variable));

I came up with this code for ApplyAML() which does not work.

ApplyAML():

 1) var doc = innovator.newItem();
 2) doc.loadAML("<Item type='b' action='get' select='a'>" +
                "<c condition='like'>'%{d}%'</c>" +   "</Item>");   
 3) var res = doc.apply();

The method is a client-side java script.

Thanks

Parents
  • Hi,

    If you need to use applySQL, you can do it on server side only like this:
    var superidentity = Aras.Server.Security.Identity.GetByName("Administrators");
    bool permissionWasSet = Aras.Server.Security.Permissions.GrantIdentity(superidentity);

    var sql= "your sql order here";
    var updateReturn = innovator.applySQL(sql);
    if (permissionWasSet) {
    Aras.Server.Security.Permissions.RevokeIdentity(superidentity);
    }

    If you need to do it in javascript, you will have to call the server method from the javascript.

Reply
  • Hi,

    If you need to use applySQL, you can do it on server side only like this:
    var superidentity = Aras.Server.Security.Identity.GetByName("Administrators");
    bool permissionWasSet = Aras.Server.Security.Permissions.GrantIdentity(superidentity);

    var sql= "your sql order here";
    var updateReturn = innovator.applySQL(sql);
    if (permissionWasSet) {
    Aras.Server.Security.Permissions.RevokeIdentity(superidentity);
    }

    If you need to do it in javascript, you will have to call the server method from the javascript.

Children
No Data