Go Back   CHECKBOX® Online Community > Checkbox® > CHECKBOX® Developer Kit

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-20-2007, 01:12 AM
Shane Shane is offline
Junior Member
 
Join Date: Jul 2007
Posts: 7
Default Creating users using the API

We have a few questions regarding using the developer kit version of the software...

1. How can we save the email address while creating the user ?
2. How can we as assign roles to the users like Respondent , Report Viewer etc.. ?

Public Static bool CreateGroup(
string name,
string description,
Arraylist[] useridentites
)
Message : No overload for method 'CreateGroup' takes '3' arguments

If we use this

Public Static bool CreateGroup(
string name,
string description,
)
Mesage : "You do not have permission to perform this operation."

3. How can we give the permission to the user so that we can create the group ?

4. Cannot find this class/ DLL "using Checkbox.Web.Services.Proxies "

Services folder is not in the developer kit....
UserManagementServiceProxy wsProxy = new UserManagementServiceProxy();

wsProxy.Url = "http://myServer/checkbox/services/UserManagementService.asmx";
Reply With Quote
  #2 (permalink)  
Old 07-20-2007, 08:01 AM
ncushing ncushing is offline
Administrator
 
Join Date: Mar 2007
Location: Prezza Technologies
Posts: 171
Default

Shane,

The first issue is that the User Management Web Services layer will be part of Checkbox 4.3, which is currently in QA and expected to be released in the first half of next month. This is likely why you can't find the services folder or the WebServiceProxy.dll.

There should be a document (WebServiceDeveloper.pdf) that describes how to build a Visual Studio project that consumes a web service. If you do not have this document, please contact support. Since it is new to version 4.3, it may not have been provided as part of the developer documentation package.

To answer your specific questions:
1) Checkbox allows users and user profile information to be stored separately. As a result, you would create the user first then store the profile. If you are using the web services, you can do this all in one step via the CreateUser(...) method.

2) Outside of a web service, you would use the RoleManager.AddIdentityToRole(userName, roleID) method. Using the Web Services API, you would call SetUserRoles(...). Both of these appear to have been omitted from the documentation, so I'll make sure they get into the documentation for 4.3.

??) This is somethign we've fixed in 4.3. Some of the user group management functions performed auth checks that hindered using the API via web services or some other method. These methods expected that a user principal had been logged-in via the UserManager.AuthenticateUser(...) which is usually only the case when modifying the Checkbox web application, not when writing third party apps. As I stated above, this limitation has been addressed in 4.3.

3) Permission checks are done in two parts. The first is to check that a user is in a role that allows the operation, and the second is to check the ACL permission on the resource for the actual object to be modified. To create a group, a user needs to be in the Group Administrator role and to edit a group, a user should have Group.Edit permission on a particular group's ACL.

4) Sorry for any confusion here. It looks like the documentation you recieved was a little bit ahead of the release.

-Noah
Reply With Quote
  #3 (permalink)  
Old 07-23-2007, 08:50 AM
ncushing ncushing is offline
Administrator
 
Join Date: Mar 2007
Location: Prezza Technologies
Posts: 171
Default

Sorry, I realize I didn't actually answer your question about roles...

To manage user roles and find out what roles a user is in, use static methods on the RoleManager class, which is in the Checkbox.Security namespace.

Code:
//List names of roles a user is in
public static string[] GetRoles(IIdentity identity);


//Get the database ID of a role 
public static int GetRoleID(string roleName);

//Associate a user with a role
public static void AddIdentityRole(IIdentity identity, int roleID);

//Remove the association between a user and a role
public static void RemoveIdentityRole(IIdentity identity, int roleID)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:28 PM.


Search Engine Friendly URLs by vBSEO 3.0.0 RC8