app/controllers/users_controller.rb
# Generates CODAP-style user info, suitable for passing into its authentication routines
Generates CODAP-style user info, suitable for passing into its authentication routines
Generates CODAP - style user info suitable for passing into its authentication routines
def info
    if current_user
      @user = current_user
      authorize! :info, @user
      render json: {
        valid: true,
        sessionToken: "abc123", 
        enableLogging: false,   
        privileges: 0,          
        useCookie: false,       
        enableSave: true,       
        username: @user.username,
        name: @user.name
      }
    else
      authorize! :info, :nil_user
      info = {
        valid: false,
        enableSave: !!codapParams[:runKey]
      }
      render json: info, status: 401
    end
  end
def info if current_user @user = current_user authorize! :info , @user render json : { valid : true , sessionToken : "abc123" , enableLogging : false , privileges : 0 , useCookie : false , enableSave : true , username : @user . username , name : @user . name } else authorize! :info , :nil_user info = { valid : false , enableSave : ! ! codapParams [ :runKey ] } render json : info , status : 401 end end
Generates CODAP-style user info, suitable for passing into its authentication routines
Generates CODAP - style user info suitable for passing into its authentication routines
# unnecessary, but here to avoid breaking anything # disabled, for now # 1 means developer. For now, nobody is a developer. # ??? # Saving is good.