I want to create an admin user for a Magento store using the web services and not having to create it from the adminstrators web site. Is that possible??
Thanks in advance!
Check out this project: https://github.com/nvahalik/Wiz.
Wiz lets you do many cumbersome tasks (normally done in the Magento Admin Panel) from command line. Although it isn't a webservice, it allows you to skip the need of logging into the admin panel and clicking around.
BTW, one of these tasks is creating an admin user.
One approach that takes a bit of custom coding is to create a new API resource that can use the Mage::getModel('admin/user') model to create the admin user.
I found it, since I was trying to do all that in C#, here is the simple code to do that:
MagentoService proxy = new MagentoService();
string sessionId = proxy.login(username, password);
customerCustomerEntityToCreate ctc = new customerCustomerEntityToCreate();
ctc.email = email;
ctc.firstname = firstname;
ctc.lastname = lastname;
ctc.password = password;
proxy.customerCustomerCreate(sessionId, ctc);
First Step
Bind the new user to a predefined role. A role for the API must be created in System → Web Services → Roles before it can be assigned here.
Source
Second Step
Use SOAP v1/v2 or XML-RPC (in my case it's SOAP v1)
Here's the
Tutorial link. You can manage customer till manage order.
Hope this help.
Related
I am creating a flask app to be used internally in my company. I would like to restrict what a user can do it based on its login ID. I read a lot about using LDAP3 but I don't think I can do what want which send the login ID to the server. There I would have a table which will register which part of the system has the permition to edit. If it try to change somenthing not permited the app will retrieve a warning message.
I won't to do that to avoid having to create a separate login functionality just for this app. I read that I should use AD authentication but I am not very familiarized with that and I would also like to avoid having to ask our IT department to create user groups there for each part of my system.
I know that I can do that using ASP .NET (at least I did once).
Any guidance will be apreciated.
I think you are looking for Role-based Authorization.
In order to use this functionality you will need to implement roles on your model file per the Data-models documentation.
This will allow you to assign users a role when they are created, and you can use a decorator on your routes to 'require' the user to have the role you want them to have before they access the endpoint.
I am trying to create a process that will create users in g suite using Java.
The Google documentation is a little bit confusing for me but I manage to create a G Suite user on localhost. The problem is when I deploy de application on a specific id the redirect URL for auth doesn't work anymore.
I manage to do this by adapting this quick start: https://developers.google.com/admin-sdk/directory/v1/quickstart/java
My question is related to google popup. How can I prevent this popup, is there a way to use a simple secret key?
If not how can I configure my application from google console to allow multiple sites to receive the auth token?
Thank you
You cannot create new users in Gsuite without OAuth2. When you run the quickstart program it will open a new tab and asked for Authentication & Authorization. Once you complete the Authorization it will store the token in your project folder. When you add users to Gsuite(you need to write code using documentation) it will use that token (Access token). It will not ask for authorization again. So you need to authorize your application in order to create users in Gsuite. In case you delete that token, it will ask to Authorize the application.
I want to create an Account programmatically and then create a number of Contacts programmatically and associate them with the Account.
We have a number of vTiger instances that run on the same server and I am building a custom manager to add Accounts and Contacts to targeted vTiger instances.
In the custom manager the workflow is a user can select the target vTiger instance from a select menu, this action fills out some details in the custom manager form. On submitting this form the system navigates to the targeted vTiger instance and creates the account and contact.
I had a look at the Webservice tutorial but with our infrastructure we would prefer to avoid HTTP. I can (folder) navigate to a vTiger instance and invoke a class. I can then pass an array to that class to create the Account or Contact. This way we are reducing security risks by using HTTP and everything is internal.
Could anyone point me in the right direction?
To create an Account you can create a function will contains this:
(You must include all mandatories fields)
global $current_user;
include_once 'modules/Accounts/Accounts.php';
$my_account = new Accounts();
$my_account->column_fields['accountname'] = $accountName;
$my_account->column_fields['accounttype'] = $accountType;
$my_account->column_fields['email1'] = $email;
$my_account->column_fields['assigned_user_id'] = $current_user->id;
$my_account->save('Accounts');
To update an existing Account:
$moduleName = 'Accounts';
$recordModel= Vtiger_Record_Model::getInstanceById($accountId,$moduleName);
$recordModel->set('accountname', $myNewAccountName);
$recordModel->set('mode', 'edit');
$recordModel->save();
I need to add new user in Wso2 CEP (3.1.0) and I know that is possible by "clicking" few steps in console (example from documentation). I wonder if it possible to add new user without login into console, but connect to H2 database and insert user there?
I know that new user is save into "UM_USER" table.
Maybe someone knows what class write user into H2, how passowrd is enrcypted and what is "UM_SALT_VALUE" and why I need it?
If all you want is to manage users programmatically, a better way rather than trying to modify H2 DB is to do it through the relevant admin service. This way you don't have to bother about the underlying user-store or the salt values used for hashing passwords etc.
In Carbon-based products, most of the configurations done through the web console can be done programmatically by calling the relevant admin web service, such as user management, adding/managing deployment artifacts etc.
So for you use case, you can use the User Management admin service at:
https://localhost:9443/services/UserAdmin?wsdl
Note that in order to access this wsdl, you should make these admin service wsdl's visible by editing <CEP>/repository/conf/carbon.xml and restart the server.
<HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>
I have to create a separate web project to access the Roles and Users API for sitecore domain, so I can programmatically add new Roles with custom access to the tree as well as custom language access. I have found the documentation for Security API, http://sdn.sitecore.net/upload/sitecore6/sc61keywords/security_api_cookbook_usletter.pdf
But I am not sure how to go about adding a new role, can I just create any type of project, like MVC4 or does it have to be in WebForms? Is this even possible to add custom permission to the tree by adding new roles and assigning them new users through API, so they can just login normally through the SiteCore domain? Also, what database am I supposed to use, I see there are 3 different ones (core,master,web), do I have to manually connect to the database and add roles there, or the API's will do that for me?
I ended up creating a class that lets me add new languages(regions) when needed. Here is the idea I worked with.
using(new Sitecore.Security.Accounts.UserSwitcher(user) //To switch to any user you want, in my case it was the "sitecore/admin"
System.Web.Security.Roles.CreateRole(roleName) //To create roles
var role = Sitecore.Security.Accounts.Role.FromName(roleName) //To retrieve the role.
//Get a list of the permissions that you would like to set
//For every item in that list
AccessRuleCollection accessRule = Item.Security.GetAccessRules();
acessRule.Helper.AddAccessPermission(role,AccessRight,PropagationType,AccessPermission);
//Write the Rules back to the item
Item.Editing.BeginEdit();
Item.Security.SetAccessRules(accessRules);
Item.Editing.EndEdit();
Hope that helps.