• Kampfschnake
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

public class checksobjectprofiles
{

public List<SelectOption> ListOfUser {public get; private set; }

public String selecteduserId { get; set; }

public string searchresult;
public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
public List <SelectOption> objectNames{public get; private set;}
public String selectedObject {get; set;}
public boolean updatecheck;
// public Boolean isUpdateable();

public checksobjectprofiles ()
{
objectNames = initObjNames();
ListOfUser= initListOfUser();


}
private List<SelectOption> initObjNames()
{
List<SelectOption> objNames = new List<SelectOption>();
List<String> entities = new List<String>(schemaMap.keySet());
entities.sort();
objNames.add(new SelectOption( ' ' ,'---Select---'));
for(String name : entities)
{


objNames.add(new SelectOption(name,name));
}
return objNames;
}

private List<SelectOption> initListOfUser()
{
// String uid = UserInfo.getUserId();
List<User> thisUser = [select id, Username, profile.name from User where IsActive=true];
List<SelectOption> Ulist = new List<SelectOption>();
Ulist.add(new SelectOption( ' ' ,'---Select---'));
for(User u : thisuser )
{

Ulist.add(new SelectOption(u.Username ,u.username));
}
return Ulist ;
}

public void checkFields()
{

//fields.clear();
system.debug('$$$$$' + selectedObject);
list<string> lstFields = new list<string>();

list<string> sobjectfields = new list<string>();
Map <String, Schema.SObjectField> fieldMap = schemaMap.get(selectedObject).getDescribe().fields.getMap();
for(Schema.SObjectField sfield : fieldMap.Values())
{
schema.describefieldresult fieldresult = sfield.getDescribe();

lstFields.add(fieldresult.getName());
// system.debug('#######' + lstFields );
}

// system.debug('@@@@@@@@@@@@@@@@@@@'+selectedObject);

Map<String,Schema.SObjectType> gd = Schema.getGlobalDescribe();
Schema.DescribeSObjectResult r = gd.get(selectedObject).getDescribe();
String tempName = r.getName();
system.debug('*************'+tempname);
system.debug('selecteduserid'+selecteduserId);
system.debug('%%%%%%%%%%%%%%'+lstFields);

searchresult= 'select' + lstFields +'from' + 'tempName' + ' WHERE ' + ' Id =: selecteduserId ';

system.debug('*************'+searchresult);
// return Database.query(searchresult);
system.runas(selecteduserid)
{
if(searchresult != NULL )
{
updatecheck=searchresult.isUpdateable(); ============> here, iam getting an error please hepl me, how to solve solve it ...just user have access fields means enable checkbox in visaulforce page
}
}


}



}

I am following the guidelines from the Chatter guide and somehow I can't get the OAuth to work. 

 

It's not working from Java or curl.   Here is what I am doing:

 

mike$ curl --form client_id=3MVG9yZ.WNe6bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxu5AjB4oT9kxi8SEhY --form client_secret=26542xxxxxxxxxxx78  --form grant_type=password --form username=xxxxxxxx@gmail.com --form password=xxxxxxx https://na11.salesforce.com/services/oauth2/token

 

What I am getting is:

{"error":"invalid_grant","error_description":"authentication failure - Invalid Password"}

 

I double checked and I am getting into na11 with the right password.  Is there anything else I need to do?

 

Here are the settings in my remote access:

 



Applicationchatter



Callback URLhttps://na11.salesforce.com/ConnectTest/oauth/_callback /// temp one



No user approval required for users in this organizationNot Checked