Possible to create Rally TimeEntryItem for other user? - rally

Is there a way to create a TimeEntryItem for another user?
I can persist the 'User' field before creating a new TimeEntryItem and see the User information being passed to Rally, but so far I get the following warning in the response, and the create request is treated as being for the calling user...
Warnings:["Ignored JSON element TimeEntryItem.User during processing
of this request."]

I don't think this is currently possible via the api. The warning you are getting above indicates that the User field is not writable, even on initial creation. So it is always just populated with the value of the current user making the request.

Related

Strapi: how to create a new model that belongs to a user?

I'm just getting started with Strapi.io and I'm currently working on a dummy project to test it out. Note that since I'm using the UI, I don't have any code to share, but I'll try to be as explicit as I can to describe what I want and what I've tried.
I have created a "todo" collection type that has a title, description, category and a user associated with it. The user is a relationship (one user has many todos) to the default user entity created with the Strapi app. When I run http POST http://localhost:1337/todos "Authorization: Bearer <TOKEN>" title="title" description="description" category="category" (I'm doing it with Postman) it works, but I see that the user field is null. I would like it to be automatically assigned based on the user who posted this command. Is that possible to achieve?
Many thanks!
Yes, it's absolutely possible. The way you do this is, you first identify which user actually made this request. This can be done by accessing the ctx.state.user variable. This is a global variable set by Koa so you can access this in the controller. Now to save the relationship of user against the todo collection entry you only need to pass the user id of the user calling this api. This can be retrieved by using ctx.state.user.id. So you can use the code below to create a todo collection correctly:
Sample code:
await strapi.services.todo.create({
title: 'My Todo Title',
description: 'My Description here',
category: 'Work',
user: ctx.state.user.id
})
P.S: You need to make sure you're logged in and are using a bearer token while calling the api or else, ctx.state.user will be null.

How do you have the API recognize the "Template ID" on DOCUSIGN. I am putting the template but its blank

I have the API built in my custom CRM and its working fine but the issue is that the application is being sent out blank. We currently have it were we already have the necessary fields that will guide the client through the process instead of them having to drag and drop certain items.
Assuming you're defining the template ID correctly in the call, the next most likely cause of failure is that your Recipients aren't being correctly assigned to the Template Roles.
Can you confirm the Role Names in your template match what you're assigning in the API call?

How do I store user defined values in wit.ai?

I am new to chatbots and using the wit.ai.
I had like to store user defined values for future use, such as Name of the user.
When the user says his name. It gets stored in a variable that can be used later.
Using entities limits me to a predefined list of names.
They have changed the getting started guide. Initially they showed the way to store user queries.
What you want to use is context object. It can store information which you want to pass on for later use. It is used to save the state of conversation.
In your story, click on Bot Executes, then an action to be executed at backend and finally type the variable name like username in the update context keys with field. This will make username available for use.

How do get userIdentity of current login request from list of all login users identities?

I want to restrict user for multiple login at a same time. Am following custom authentication method from below link
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/authentication-security/custom-authentication/
To achieve, I wanted know whether current login request is already logged in or not from some other device(session). Where or from which method am going get these details?
Please let me know how to get and return error custom message from this java file to adapter's calling method.
I don't believe any of the built-in APIs will provide what you are looking for.
Instead, I think you need to create your own implementation from scratch. Meaning, create some database to store the current status of each user. Update it every time, check the status whenever someone tries to login ...

Grails Spring Security forcing user to a specific screen after successful authentication

Here is the scenario. I have two objects Users (with username/password) and UserInfo with rest of the data related to user. The Users is an old table with thousands of records and UserInfo is fairly new. I want to get as much UserInfo as I can when the user first logs in.
I'd like to force user to a custom screen after first login and ask for the UserInfo data. Once I get the "required" data in the new screen, I dont show it till the user voluntarily wants to fill in the data under "Profile".
Since there are multiple entry points to the application, I dont want to update all the controllers to check for this.
Is there a way I can use a Spring Security filter or something which is executed on successful login? I had a look at ApplicationListener<AuthenticationSuccessEvent> but it doesnt solve the problem as if I copy paste the link in the browser, it lets me go ahead to the destination without asking for "extra information".
In a nutshell, I want a check after each login which, if fails, user is not allowed to enter the application. No matter how he tries to get in.
In your Config.groovy, configure Spring Security's defaultTargetUrl and tell it to always redirect there:
grails.plugins.springsecurity.successHandler.alwaysUseDefault = true
grails.plugins.springsecurity.successHandler.defaultTargetUrl = '/userInfo/edit'
In your UserInfoController's edit action, you can check that the required fields are present (userInfo.validate() perhaps?) and if they are, redirect to wherever you like, perhaps '/', otherwise render the edit info view.
You can adopt what #doelleri proposed and enhance the rule by those steps:
run a batch task to assign a temporary ROLE_DISABLED role to each user who does not provide supplemental information yet. If the user already had some roles, save them in some property.
setup your authorization rule as that users with ROLE_DISABLED role only allowed to access /userInfo/edit.
in /userInfo/edit, if the user has a ROLE_DISABLED role, render the information input view, and resume user's role after it successfully updated its information. Otherwise redirect to '/' or the path it requested.