OpenIdLogin class

From Catglobe Wiki
Jump to: navigation, search

OpenIdLogin



Represents an association between a user and an openId identifier. This will allow the user to login by specifying the identifier (or the short version) with an openid=xxx url parameter on any link.

Parent class

Inherits from object

Constructors

  • (string claimedIdentifier "The identifier (url) too lookup.") - Fetch an existing association from the identifier.
  • (int userResourceId "Resource Id of the user to associate an openId with.", string claimedIdentifier "The identifier (url) too create with. It must be unique across all users.") - Create a new association between a user and an identifier.
  • (int userResourceId "Resource Id of the user to associate an openId with.", string site "The site name of the foreign site. E.g. cg.catglobe.com", string username "The username on the foreign site") - Create a new association between a user and an identifier on a catglobe site.

Methods

  • Empty Destroy() - Remove the current association from the database.
  • Empty Save() - Save the current association to the Database. Requires admin group access
  • (From object) string ToString() - The string representation of the object.

Properties

  • string ClaimedIdentifier { get; } - The identifier (url) of this association
  • string ObjectTypeName { get; } - The name of the type of object.
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.
  • int UserResourceId { get; } - Resource id of the user having this association


Examples

/* 
	ON ABC.CATGLOBE.COM SITE - CREATE OPENID LOGIN FOR CONSULTANTS OF CG SITE TO ACCESS TO ABC.CATGLOBE.COM SITE
*/

number UserRID_ThisSite = 123456789;    		// user: tungocman
object OpenId;
number i;

/* Specify the value for parameters */
string Foreign_Site = "cg.catglobe.com";
string UserName_ForeignSite = "man-cgsite";   
string Password_ForeignSite = "123456";
number ForeignWorkflow_id = 111222333; 			// Workflow: List of usernames of members of a specific group

number GroupRID = 45384;     			        // Group: Consultants Group
bool includeStatic = true;
bool includeDynamic = true;

Dictionary Parameter = {"GroupRID":GroupRID, "includeStatic":includeStatic, "includeDynamic":includeDynamic};

RemoteWorkflowCall wfc = new RemoteWorkflowCall(ForeignWorkflow_id, UserName_ForeignSite, Password_ForeignSite, {Parameter});
array GroupMemberNames = wfc.Call(Foreign_Site);
print(GroupMemberNames);
print(GroupMemberNames.Count);

for(i = 0; i < GroupMemberNames.Count; i = i+1)
{
	OpenId = new OpenIdLogin(UserRID_ThisSite, Foreign_Site, GroupMemberNames[i]);
	OpenId.Save();
	print(OpenId.ClaimedIdentifier);
}


=====================================================
/* 
	
	FOREIGN WORKFLOW ON CG.CATGLOBE.COM SITE - WORKFLOW RETURN A ARRAY OF USERNAMES OF MEMBERS OF A SPECIFIC GROUP
*/

array Paras = Workflow_getParameters();

number GroupRID;
bool includeStatic;
bool includeDynamic;

array Result;  			                        // an array of usernames of members of a specific group
array GroupMembers;
array UserObject;
number i;

GroupRID = Paras[0]["GroupRID"];
includeStatic = Paras[0]["includeStatic"];
includeDynamic = Paras[0]["includeDynamic"];

GroupMembers = Group_getMembers(GroupRID, false, false, includeStatic, includeDynamic);

for(i = 0; i < GroupMembers.Count; i = i+1)
{
	UserObject = User_getUserByResourceId(GroupMembers[i]);
	Result.Add(UserObject[USER_NAME]);
}
return Result;