# Would it be a good idea to put a \`submitUser\` example into the Skeleton template?

**URL:** <https://forum.canton.network/t/would-it-be-a-good-idea-to-put-a-submituser-example-into-the-skeleton-template/4776>\
**Category:** App Development\
**Created:** [June 22, 2022, 8:36am UTC](https://forum.canton.network/t/would-it-be-a-good-idea-to-put-a-submituser-example-into-the-skeleton-template/4776 "2022-06-22T08:36:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gyorgybalazsi](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/gyorgybalazsi/32/684_2.png) [@gyorgybalazsi](https://forum.canton.network/u/gyorgybalazsi)\
**Post date:** [June 22, 2022, 8:36am UTC](https://forum.canton.network/t/would-it-be-a-good-idea-to-put-a-submituser-example-into-the-skeleton-template/4776/1 "2022-06-22T08:36:45Z")

</div>

Currently, the Skeleton template (used for project creation when no template is specified to the `daml new <project name>` command) contains an example of user creation, but the created users are not utilised for contract creation. The contract instances are created in the pre-user-management way, using party ids:

```haskell
setup : Script AssetId
setup = script do
-- user_setup_begin
  alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
  bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
  aliceId <- validateUserId "alice"
  bobId <- validateUserId "bob"
  createUser (User aliceId (Some alice)) [CanActAs alice]
  createUser (User bobId (Some bob)) [CanActAs bob]
-- user_setup_end

  aliceTV <- submit alice do
    createCmd Asset with
      issuer = alice
      owner = alice
      name = "TV"

  bobTV <- submit alice do
    exerciseCmd aliceTV Give with newOwner = bob

  submit bob do
    exerciseCmd bobTV Give with newOwner = alice

```

In this way, it’s not really clear why we bother creating users.

An alternative example, actually using the `submitUser` and the `grantUserRights` command could better illuminate the rationale behind user management.

```haskell
setup : Script AssetId
setup = script do
-- user_setup_begin
  alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
  bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
  public <- allocatePartyWithHint "Public" (PartyIdHint "Public")
  
  aliceId <- validateUserId "alice"
  bobId <- validateUserId "bob"
  createUser (User aliceId (Some alice)) [CanActAs alice]
  createUser (User bobId (Some bob)) [CanActAs bob]
-- user_setup_end

  aliceTV <- submitUser aliceId do
    createCmd Asset with
      issuer = alice
      owner = alice
      name = "TV"

  bobTV <- submitUser aliceId do
    exerciseCmd aliceTV Give with newOwner = bob

  aliceTVagain <- submitUser bobId do
    exerciseCmd bobTV Give with newOwner = alice 

  -- | We grant the right to act as alice to the user of Bob,
  -- so he can take back the asset.

  grantUserRights bobId [CanActAs alice] 

  submitUser bobId do
    exerciseCmd aliceTVagain Give with newOwner = bob

```

---

<div class="post-metadata">

**Author:** ![Remy](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/remy/32/595_2.png) [@Remy](https://forum.canton.network/u/Remy)\
**Post date:** [June 27, 2022, 9:50am UTC](https://forum.canton.network/t/would-it-be-a-good-idea-to-put-a-submituser-example-into-the-skeleton-template/4776/2 "2022-06-27T09:50:15Z")

</div>

This is a very good suggestion. Thanks.
