Question about defining an update method with rust

For that to work you’ll need to first get your canister’s controllers, have them in a vec or something and then iterate over that vec to check if the caller is on that list.

There are a few ways to get a canister’s controllers, but surprisingly not an ic_cdk simple API to do so. The easiest is to first add the return from “ic_cdk::api::caller()” inside your init() function. That will give you the dfx principal (with the latest dfx deploy). With that added you could have a manual function, guarded by the first controller, to add more controllers.

An advanced method is to call the management canister asking for a status of your own canister_id, and that will return ALL the controllers of a canister.

Check my post here. Also you can check my quickstart scaling repo for the implementation of the above is_controller. Note that how you add & keep track of controllers is up to you, until we get a simple ic_cdk api.