# How do I create a User that have two signatory User and its creator i.e System User

**URL:** <https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414>\
**Category:** App Development\
**Tags:** daml\
**Created:** [October 7, 2020, 5:59am UTC](https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414 "2020-10-07T05:59:50Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muhammad\_Moiz](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/muhammad_moiz/32/840_2.png) [@Muhammad\_Moiz](https://forum.canton.network/u/Muhammad_Moiz)\
**Post date:** [October 7, 2020, 5:59am UTC](https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414/1 "2020-10-07T05:59:50Z")

</div>

I am trying to create User But it show me this error

**create of User:User at DA.Internal.Prelude:381:26**  
**failed due to a missing authorization from Bob**  
here is my sample template

```
template SystemUser
        with
            name : Text
            systemUser : Party
        where
            signatory systemUser 

     nonconsuming choice CreateUser : ContractId User
             with
                _profileId : Int
                _code : Optional Text
                _name : Optional Text
                _email: Optional Text
                user : Party 
            controller systemUser
             do create User with
                  profileId = _profileId 
                  code = _code
                  name = _name
                  email = _email
                  status = _status
                  user 
                  systemUser  

type UserKey = (Party, Int)

 template User
    with
        profileId : Int
        code : Optional Text
        name : Optional Text
        email: Optional Text
        status : Text
        user : Party
        systemUser : Party
 where
    signatory [systemUser , user]  

    key ( user, profileId ) : Userkey
    maintainer key._1

```

here is my scanerio

```
systemUser <- getParty "Alice"
user <- getParty "Bob"

   uid <- submit systemUser do
        create SystemUser
            with
                name = "Alice"
                systemUser

asid <- submit systemUser $ exercise uid CreateUser
    with
      _name = Some "Bob" 
      _profileId = 1  
      _code = Some "ATL"
      _email = "abc@gmail.com"
      user
```

---

<div class="post-metadata">

**Author:** ![Luciano](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/luciano/32/319_2.png) [@Luciano](https://forum.canton.network/u/Luciano)\
**Post date:** [October 7, 2020, 6:36am UTC](https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414/2 "2020-10-07T06:36:27Z")

</div>

Hi!

First, the error message you gave doesn’t tally up with the scenarios - it mentions a `AssociateUser`, whereas your example has `SystemUser`. Can you check these are consistent?

Second, looking at your code example, the `createUser` choice sets the `user` field to that passed as an argument. I don’t think this is allowed; otherwise, you would have an authorization loophole - you could just pass _any_ old party to that choice. Instead, Bob should explicitly give their consent to the creation of this contract, by using e.g. a [propose/accept pattern](https://docs.daml.com/daml/patterns/initaccept.html).

---

<div class="post-metadata">

**Author:** ![Muhammad\_Moiz](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/muhammad_moiz/32/840_2.png) [@Muhammad\_Moiz](https://forum.canton.network/u/Muhammad_Moiz)\
**Post date:** [October 7, 2020, 6:40am UTC](https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414/3 "2020-10-07T06:40:09Z")

</div>

Updated

---

<div class="post-metadata">

**Author:** ![Muhammad\_Moiz](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/muhammad_moiz/32/840_2.png) [@Muhammad\_Moiz](https://forum.canton.network/u/Muhammad_Moiz)\
**Post date:** [October 7, 2020, 6:55am UTC](https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414/4 "2020-10-07T06:55:51Z")

</div>

But is there any other way to create User without proposal/accept pattern because I want to create User without his permission. And proposal accept pattern involve approval from both parties.

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [October 7, 2020, 6:57am UTC](https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414/5 "2020-10-07T06:57:12Z")

</div>

In DAML, you can never force someone to signing a contract unless they agreed to it. If you don’t want the user to agree, they cannot be a signatory of the contract.

---

<div class="post-metadata">

**Author:** ![Luciano](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/luciano/32/319_2.png) [@Luciano](https://forum.canton.network/u/Luciano)\
**Post date:** [October 7, 2020, 7:02am UTC](https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414/6 "2020-10-07T07:02:00Z")

</div>

Perhaps it’s enough just to remove Bob from the `User.signatories`, given you description of the behaviour you want.

---

<div class="post-metadata">

**Author:** ![Muhammad\_Moiz](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/muhammad_moiz/32/840_2.png) [@Muhammad\_Moiz](https://forum.canton.network/u/Muhammad_Moiz)\
**Post date:** [October 7, 2020, 7:07am UTC](https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414/7 "2020-10-07T07:07:05Z")

</div>

But if I want to fetch user by key than how do I do this?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [October 7, 2020, 7:08am UTC](https://forum.canton.network/t/how-do-i-create-a-user-that-have-two-signatory-user-and-its-creator-i-e-system-user/1414/8 "2020-10-07T07:08:27Z")

</div>

You can still make the user part of the key but you need to include the system user as well. So something like

```haskell
key (systemUser, user, profileId) : (Party, Party, Int)

```
