pub fn update_token(
        &self,
        token: &str,
        permissions: usize,
        user: Option<String>,
        description: Option<String>,
        allowed_indexes: Option<Vec<String>>,
    ) -> Option<Arc<TokenData>> {
        let mut new;
        {
            let existing = self.keys.load();
            new = existing.as_ref().clone();
        }

        let existing = new.get(token)?;

        let data = Arc::new(TokenData {
            token: token.to_string(),
            allowed_indexes,
            permissions,
            created: existing.created,
            user,
            description,
        });

        new.insert(data.token.clone(), data.clone());
        self.keys.store(Arc::new(new));

        Some(data)
    }
/// Updates a given token with new metadata.
///
/// Similar to create_token, update token updates an existing token's
/// metadata with a new set of metadata.
Updates a given token with new metadata.
Similar to create_token, update token updates an existing token's
metadata with a new set of metadata.
Updates a given token with new metadata . Similar to create_token update token updates an existing token ' s metadata with a new set of metadata .
pub fn update_token(
        &self,
        token: &str,
        permissions: usize,
        user: Option<String>,
        description: Option<String>,
        allowed_indexes: Option<Vec<String>>,
    ) -> Option<Arc<TokenData>> {
        let mut new;
        {
            let existing = self.keys.load();
            new = existing.as_ref().clone();
        }
        let existing = new.get(token)?;
        let data = Arc::new(TokenData {
            token: token.to_string(),
            allowed_indexes,
            permissions,
            created: existing.created,
            user,
            description,
        });
        new.insert(data.token.clone(), data.clone());
        self.keys.store(Arc::new(new));
        Some(data)
    }
pub fn update_token ( & self , token : & str , permissions : usize , user : Option < String > , description : Option < String > , allowed_indexes : Option < Vec < String > > , ) -> Option < Arc < TokenData > > { let mut new ; { let existing = self . keys . load ( ) ; new = existing . as_ref ( ) . clone ( ) ; } let existing = new . get ( token ) ? ; let data = Arc :: new ( TokenData { token : token . to_string ( ) , allowed_indexes , permissions , created : existing . created , user , description , } ) ; new . insert ( data . token . clone ( ) , data . clone ( ) ) ; self . keys . store ( Arc :: new ( new ) ) ; Some ( data ) }
Updates a given token with new metadata.
Updates a given token with new metadata .
&self
token
&str
permissions
usize
user
Option<String>
description
Option<String>
allowed_indexes
Option<Vec<String>>
&self
token
&str
permissions
usize
user
Option<String>
description
Option<String>
allowed_indexes
Option<Vec<String>>